Upstream: bluetooth: Add the device into hash table when relevant
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Thu, 16 Aug 2012 13:36:37 +0000 (16:36 +0300)
committerJaehyun Kim <jeik01.kim@samsung.com>
Thu, 4 Apr 2013 06:40:17 +0000 (15:40 +0900)
Fixes BMC#25215

Change-Id: Ic06d2a9eb49802e0b4e97ffe83acd8d19da3e3c4

plugins/bluetooth.c

index b1cf0c4..1389928 100644 (file)
@@ -660,8 +660,6 @@ static void adapter_properties_reply(DBusPendingCall *call, void *user_data)
        if (device != NULL)
                goto update;
 
-       g_hash_table_insert(bluetooth_devices, g_strdup(path), device);
-
        ether_aton_r(address, &addr);
 
        snprintf(ident, 13, "%02x%02x%02x%02x%02x%02x",
@@ -676,6 +674,8 @@ static void adapter_properties_reply(DBusPendingCall *call, void *user_data)
        if (device == NULL)
                goto done;
 
+       g_hash_table_insert(bluetooth_devices, g_strdup(path), device);
+
        connman_device_set_ident(device, ident);
 
        connman_device_set_string(device, "Path", path);