From b405d2da26862049c1a46436cadeb39699cc0c63 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Thu, 14 Jul 2011 13:36:58 -0300 Subject: [PATCH] Drop GAttrib ref if callback list is empty If all ATT connection callbacks are unregistered, GAttrib reference can be dropped. --- src/device.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/device.c b/src/device.c index 1f452115b..571a287e0 100644 --- a/src/device.c +++ b/src/device.c @@ -2603,10 +2603,18 @@ gboolean btd_device_remove_attio_callback(struct btd_device *device, guint id) g_free(attio); + if (device->attios != NULL) + return TRUE; + if (device->attioid) { g_source_remove(device->attioid); device->attioid = 0; } + if (device->attrib) { + g_attrib_unref(device->attrib); + device->attrib = NULL; + } + return TRUE; } -- 2.47.3