When GATT client is destroyed, unset service changed watcher 24/97424/1
authorSeungyoun Ju <sy39.ju@samsung.com>
Mon, 1 Feb 2016 07:51:14 +0000 (16:51 +0900)
committerSudha Bheemanna <b.sudha@samsung.com>
Mon, 14 Nov 2016 07:01:38 +0000 (12:31 +0530)
Change-Id: Ie90820e7fab11434b7d874f0d8da40620e5a1cd9
Signed-off-by: Sudha Bheemanna <b.sudha@samsung.com>
src/bluetooth-gatt.c

index a17cd5bd1a5ce7cc453c65f6d9e433164299a5cf..f790f01fbcf9eaebf53ce3a720a2ab5fc7b0d66c 100644 (file)
@@ -2816,6 +2816,13 @@ int bt_gatt_client_destroy(bt_gatt_client_h client)
        BT_CHECK_INIT_STATUS();
        BT_CHECK_INPUT_PARAMETER(client); /* LCOV_EXCL_START */
 
+       if (client_s->service_changed_cb) {
+               bluetooth_device_address_t bd_addr = { {0,} };
+
+               _bt_convert_address_to_hex(&bd_addr, client_s->remote_address);
+               bluetooth_gatt_set_service_change_watcher(&bd_addr, FALSE);
+       }
+
        g_free(client_s->remote_address);
        g_slist_free_full(client_s->services, __bt_gatt_free_service);
        gatt_client_list = g_slist_remove(gatt_client_list, client_s);