diff --git a/src/shared/mgmt.c b/src/shared/mgmt.c
index 8352550..d45c1c4 100644
--- a/src/shared/mgmt.c
+++ b/src/shared/mgmt.c
unsigned int id;
uint16_t event;
uint16_t index;
+ bool destroyed;
mgmt_notify_func_t callback;
mgmt_destroy_func_t destroy;
void *user_data;
list = g_list_next(list)) {
struct mgmt_notify *notify = list->data;
+ if (notify->destroyed)
+ continue;
+
if (notify->event != event)
continue;
return true;
}
+ notify->destroyed = true;
+
mgmt->notify_destroyed = g_list_concat(mgmt->notify_destroyed, list);
return true;
continue;
}
+ notify->destroyed = true;
+
mgmt->notify_destroyed = g_list_concat(mgmt->notify_destroyed,
list);
}
return true;
}
+static void mark_notify(gpointer data, gpointer user_data)
+{
+ struct mgmt_notify *notify = data;
+
+ notify->destroyed = true;
+}
+
bool mgmt_unregister_all(struct mgmt *mgmt)
{
if (!mgmt)
if (!mgmt->in_notify) {
g_list_foreach(mgmt->notify_list, destroy_notify, NULL);
g_list_free(mgmt->notify_list);
- } else
+ } else {
+ g_list_foreach(mgmt->notify_list, mark_notify, NULL);
mgmt->notify_destroyed = g_list_concat(mgmt->notify_destroyed,
mgmt->notify_list);
+ }
mgmt->notify_list = NULL;