g_io_channel_shutdown(gio, TRUE, NULL);
g_io_channel_unref(gio);
- gatt_characteristic_server_notify_list = g_slist_remove(gatt_characteristic_server_notify_list, chr_info);
- bluetooth_characteristic_info_free(chr_info);
+ if (g_slist_find(gatt_characteristic_server_notify_list, chr_info)) {
+ BT_INFO("found char_info in the list");
+ gatt_characteristic_server_notify_list = g_slist_remove(gatt_characteristic_server_notify_list, chr_info);
+ bluetooth_characteristic_info_free(chr_info);
+ }
return FALSE;
}
+ if (g_slist_find(gatt_characteristic_server_notify_list, chr_info) == NULL) {
+ BT_INFO("chr_info is not in the list");
+ return FALSE;
+ }
+
return TRUE;
}
BT_INFO("closing fd");
close(chr_info->write_fd);
}
+
+ BT_INFO("Removing char_info from the list");
+ gatt_characteristic_server_notify_list = g_slist_remove(gatt_characteristic_server_notify_list, chr_info);
+ bluetooth_characteristic_info_free(chr_info);
}
}