summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-06-08 23:36:03 +0800
committerJohan Hedberg <johan.hedberg@intel.com>2012-06-08 23:37:33 +0800
commit18ffa5c18bc6a2e73f23bcf6b9656854890206c2 (patch)
tree1b660f97f720ff6d474cfcf15d922b131b6ef5b3
parent1da4a66054272a628c08907be257a115016a29ae (diff)
downloadbluez-18ffa5c18bc6a2e73f23bcf6b9656854890206c2.tar.gz
gattrib: Make event callback identifiers globally unique
The attrib server code relies on these id's to be unique globally and not just per GAttrib instance. As an easy fix make them global by adding a static guint to g_attrib_register.
-rw-r--r--attrib/gattrib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/attrib/gattrib.c b/attrib/gattrib.c
index 0f011f0a1..00f59d70c 100644
--- a/attrib/gattrib.c
+++ b/attrib/gattrib.c
@@ -50,7 +50,6 @@ struct _GAttrib {
GQueue *responses;
GSList *events;
guint next_cmd_id;
- guint next_evt_id;
GDestroyNotify destroy;
gpointer destroy_user_data;
gboolean stale;
@@ -644,6 +643,7 @@ guint g_attrib_register(GAttrib *attrib, guint8 opcode,
GAttribNotifyFunc func, gpointer user_data,
GDestroyNotify notify)
{
+ static guint next_evt_id = 0;
struct event *event;
event = g_try_new0(struct event, 1);
@@ -654,7 +654,7 @@ guint g_attrib_register(GAttrib *attrib, guint8 opcode,
event->func = func;
event->user_data = user_data;
event->notify = notify;
- event->id = ++attrib->next_evt_id;
+ event->id = ++next_evt_id;
attrib->events = g_slist_append(attrib->events, event);