File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -358,10 +358,12 @@ void UPower::resetDevices() {
358
358
void UPower::setDisplayDevice () {
359
359
std::lock_guard<std::mutex> guard{mutex_};
360
360
361
- if (nativePath_.empty () && model_.empty ()) {
362
- // Unref current upDevice
363
- if (upDevice_.upDevice != NULL ) g_object_unref (upDevice_.upDevice );
361
+ if (upDevice_.upDevice != NULL ) {
362
+ g_object_unref (upDevice_.upDevice );
363
+ upDevice_.upDevice = NULL ;
364
+ }
364
365
366
+ if (nativePath_.empty () && model_.empty ()) {
365
367
upDevice_.upDevice = up_client_get_display_device (upClient_);
366
368
getUpDeviceInfo (upDevice_);
367
369
} else {
@@ -386,7 +388,6 @@ void UPower::setDisplayDevice() {
386
388
}
387
389
// Unref current upDevice if it exists
388
390
if (displayDevice.upDevice != NULL ) {
389
- if (thisPtr->upDevice_ .upDevice != NULL ) g_object_unref (thisPtr->upDevice_ .upDevice );
390
391
thisPtr->upDevice_ = displayDevice;
391
392
}
392
393
},
You can’t perform that action at this time.
0 commit comments