linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] GAttrib: Add debug message for GAttrib references
@ 2012-02-09 15:41 Claudio Takahasi
  2012-02-09 15:41 ` [PATCH BlueZ] GAttrib: Fix leak when remote disconnects Claudio Takahasi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Claudio Takahasi @ 2012-02-09 15:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

---
 Makefile.tools   |    2 +-
 attrib/gattrib.c |   11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Makefile.tools b/Makefile.tools
index eea1a9b..19a4b04 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -59,7 +59,7 @@ bin_PROGRAMS += attrib/gatttool
 attrib_gatttool_SOURCES = attrib/gatttool.c attrib/att.c attrib/gatt.c \
 				attrib/gattrib.c btio/btio.c \
 				attrib/gatttool.h attrib/interactive.c \
-				attrib/utils.c
+				attrib/utils.c src/log.c
 attrib_gatttool_LDADD = lib/libbluetooth-private.la @GLIB_LIBS@ @READLINE_LIBS@
 endif
 
diff --git a/attrib/gattrib.c b/attrib/gattrib.c
index 4d901f1..ccddabe 100644
--- a/attrib/gattrib.c
+++ b/attrib/gattrib.c
@@ -31,6 +31,7 @@
 #include <bluetooth/bluetooth.h>
 #include <bluetooth/uuid.h>
 
+#include "log.h"
 #include "att.h"
 #include "btio.h"
 #include "gattrib.h"
@@ -147,6 +148,8 @@ GAttrib *g_attrib_ref(GAttrib *attrib)
 
 	g_atomic_int_inc(&attrib->refs);
 
+	DBG("%p: ref=%d", attrib, attrib->refs);
+
 	return attrib;
 }
 
@@ -205,10 +208,16 @@ static void attrib_destroy(GAttrib *attrib)
 
 void g_attrib_unref(GAttrib *attrib)
 {
+	gboolean ret;
+
 	if (!attrib)
 		return;
 
-	if (g_atomic_int_dec_and_test(&attrib->refs) == FALSE)
+	ret = g_atomic_int_dec_and_test(&attrib->refs);
+
+	DBG("%p: ref=%d", attrib, attrib->refs);
+
+	if (ret == FALSE)
 		return;
 
 	attrib_destroy(attrib);
-- 
1.7.8.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-02-09 15:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-09 15:41 [PATCH BlueZ] GAttrib: Add debug message for GAttrib references Claudio Takahasi
2012-02-09 15:41 ` [PATCH BlueZ] GAttrib: Fix leak when remote disconnects Claudio Takahasi
2012-02-09 15:55   ` Johan Hedberg
2012-02-09 15:41 ` [PATCH BlueZ] device: Remove unused variable Claudio Takahasi
2012-02-09 15:55   ` Johan Hedberg
2012-02-09 15:54 ` [PATCH BlueZ] GAttrib: Add debug message for GAttrib references Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).