diff options
author | Bastien Nocera <hadess@hadess.net> | 2023-02-28 13:00:59 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2023-02-28 13:05:28 +0100 |
commit | 46257ff36e01326985375d0baee54f67fad1d98b (patch) | |
tree | 9b0d666f387a008f9a348da24b8a3ce4a0aa2ef6 | |
parent | b7e406d9f9484dfa9faec5e1e3fa99bab407fe89 (diff) | |
download | upower-46257ff36e01326985375d0baee54f67fad1d98b.tar.gz |
linux: Fix warning when a duplicate device appears
When a kernel device appears after the Bluetooth device, we could be
trying to bind the model property onto itself on the Bluetooth device.
Avoid this possibility by always binding the property from the bluez
device to the non-bluez device.
GLib-GObject-WARNING **: 20:20:50.644: Unable to bind the same property on the same instance
Fixes: 778b93a336bef ("linux: Hide duplicate Logitech Bluetooth devices")
-rw-r--r-- | src/linux/up-backend.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/linux/up-backend.c b/src/linux/up-backend.c index 8853b0c..a47460e 100644 --- a/src/linux/up-backend.c +++ b/src/linux/up-backend.c @@ -155,16 +155,22 @@ update_duplicate_bluez_device (UpBackend *backend, { g_autoptr(UpDevice) other_device = NULL; UpDevice *bluez_device = NULL; + UpDevice *non_bluez_device = NULL; g_autofree char *name = NULL; g_autofree char *serial = NULL; other_device = find_duplicate_device (backend, added_device); if (!other_device) return; - bluez_device = UP_IS_DEVICE_BLUEZ (added_device) ? - added_device : other_device; + if (UP_IS_DEVICE_BLUEZ (added_device)) { + bluez_device = added_device; + non_bluez_device = other_device; + } else { + bluez_device = other_device; + non_bluez_device = added_device; + } g_object_bind_property (bluez_device, "model", - other_device, "model", + non_bluez_device, "model", G_BINDING_SYNC_CREATE); g_object_get (G_OBJECT (bluez_device), "serial", &serial, NULL); up_device_unregister (bluez_device); |