From 18ffa5c18bc6a2e73f23bcf6b9656854890206c2 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 8 Jun 2012 23:36:03 +0800 Subject: [PATCH] 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. --- attrib/gattrib.c | 4 ++-- 1 file 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); -- 2.47.3