Merge pull request #3554 from 3u13r/fix/upower/dont-override-existing-upDevice

fix/upower: upower module selection with multiple devices
This commit is contained in:
Alexis Rouillard 2024-09-13 09:08:49 +02:00 committed by GitHub
commit 30f6ed05ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 4 deletions

View File

@ -384,10 +384,11 @@ void UPower::setDisplayDevice() {
displayDevice = upDevice; displayDevice = upDevice;
} }
} }
// Unref current upDevice // Unref current upDevice if it exists
if (displayDevice.upDevice != NULL) g_object_unref(thisPtr->upDevice_.upDevice); if (displayDevice.upDevice != NULL) {
// Reassign new upDevice if (thisPtr->upDevice_.upDevice != NULL) g_object_unref(thisPtr->upDevice_.upDevice);
thisPtr->upDevice_ = displayDevice; thisPtr->upDevice_ = displayDevice;
}
}, },
this); this);
} }