GAttrib disconnect function needs to be set after discovering the
primary services if the connection callback list is not empty. After
creating a device the connection can stay up, for this scenario the
registered disconnection callbacks are not being called.
---
src/device.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/device.c b/src/device.c
index 9dd657c..13749bf 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1661,7 +1661,9 @@ static void primary_cb(GSList *services, guint8 status, gpointer user_data)
if (device->attios == NULL && device->attios_offline == NULL) {
g_attrib_unref(device->attrib);
device->attrib = NULL;
- }
+ } else
+ g_attrib_set_disconnect_function(device->attrib,
+ attrib_disconnected, device);
g_slist_free(uuids);
--
1.7.6