Thread (37 messages) flat view 37 messages, 3 authors, 2011-07-27
STALE5489d

[PATCH BlueZ 08/12] Drop GAttrib ref if callback list is empty

From: Claudio Takahasi <hidden>
Date: 2011-07-14 16:36:58
Subsystem: the rest · Maintainer: Linus Torvalds

If all ATT connection callbacks are unregistered, GAttrib reference
can be dropped.
---
 src/device.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/device.c b/src/device.c
index 1f45211..571a287 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;
 }
-- 
1.7.6
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help