OSDN Git Service

core: Remove pointless protection for device path at unregister
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 20 Jan 2013 23:31:17 +0000 (15:31 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 20 Jan 2013 23:31:17 +0000 (15:31 -0800)
If such a protection is really needed, then it might should be better
handled properly within GDBus. So remove it and if it causes an issue,
fix it then.

src/device.c

index 6362130..e1219c4 100644 (file)
@@ -3990,8 +3990,6 @@ struct btd_device *btd_device_ref(struct btd_device *device)
 
 void btd_device_unref(struct btd_device *device)
 {
-       char *path;
-
        device->ref--;
 
        DBG("%p: ref=%d", device, device->ref);
@@ -3999,11 +3997,7 @@ void btd_device_unref(struct btd_device *device)
        if (device->ref > 0)
                return;
 
-       path = g_strdup(device->path);
-
-       g_dbus_unregister_interface(dbus_conn, path, DEVICE_INTERFACE);
-
-       g_free(path);
+       g_dbus_unregister_interface(dbus_conn, device->path, DEVICE_INTERFACE);
 }
 
 int device_get_appearance(struct btd_device *device, uint16_t *value)