summaryrefslogtreecommitdiff
path: root/attrib
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-06-07 09:41:50 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2012-06-07 09:41:50 +0300
commit283b4b7d694f276e421b0db823a4905983699255 (patch)
tree1d15c364524a623c365ebb1d2d9b0cafe745ddcd /attrib
parentc03184efcba31643349c734fbd4b6442782e10b3 (diff)
gattrib: Fix protection of GAttrib while calling callbacks
The callbacks could result with the reference count dropping to 0 and the object being freed. This patch fixes the issue by adding one extra reference for the duration of the timeout function.
Diffstat (limited to 'attrib')
-rw-r--r--attrib/gattrib.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/attrib/gattrib.c b/attrib/gattrib.c
index fedc42e9..0f011f0a 100644
--- a/attrib/gattrib.c
+++ b/attrib/gattrib.c
@@ -255,6 +255,8 @@ static gboolean disconnect_timeout(gpointer data)
struct _GAttrib *attrib = data;
struct command *c;
+ g_attrib_ref(attrib);
+
c = g_queue_pop_head(attrib->requests);
if (c == NULL)
goto done;
@@ -273,6 +275,8 @@ static gboolean disconnect_timeout(gpointer data)
done:
attrib->stale = TRUE;
+ g_attrib_unref(attrib);
+
return FALSE;
}