diff --git a/Makefile.tools b/Makefile.tools
index eea1a9b..19a4b04 100644
--- a/Makefile.tools
+++ b/Makefile.tools
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
#include <bluetooth/bluetooth.h>
#include <bluetooth/uuid.h>
+#include "log.h"
#include "att.h"
#include "btio.h"
#include "gattrib.h"
g_atomic_int_inc(&attrib->refs);
+ DBG("%p: ref=%d", attrib, attrib->refs);
+
return 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);