diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2011-08-17 11:30:08 +0200 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2011-08-17 11:30:08 +0200 |
commit | 7da2779fd1b6d4da62a7d92efed4321e1078b612 (patch) | |
tree | defad26b3ac916c902bda751ec3a3b86efc580ec /telepathy-glib/connection-contact-list.c | |
parent | 236aa055896672319ede0ee5f3f672a77c0dea97 (diff) | |
download | telepathy-glib-7da2779fd1b6d4da62a7d92efed4321e1078b612.tar.gz |
Correctly free a GQueue from dispose
If dispose is run twice, first run would free the queue and 2nd would
still do a g_queue_foreach() on it... I can't beleive GLib still does
not have free_func and refcount on GQueue...
Diffstat (limited to 'telepathy-glib/connection-contact-list.c')
-rw-r--r-- | telepathy-glib/connection-contact-list.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/telepathy-glib/connection-contact-list.c b/telepathy-glib/connection-contact-list.c index e66b42eaa..960d3933a 100644 --- a/telepathy-glib/connection-contact-list.c +++ b/telepathy-glib/connection-contact-list.c @@ -55,11 +55,9 @@ contacts_changed_item_new (GHashTable *changes, return item; } -void -_tp_connection_contacts_changed_item_free (gpointer data) +static void +contacts_changed_item_free (ContactsChangedItem *item) { - ContactsChangedItem *item = data; - tp_clear_pointer (&item->changes, g_hash_table_unref); tp_clear_pointer (&item->identifiers, g_hash_table_unref); tp_clear_pointer (&item->removals, g_hash_table_unref); @@ -67,6 +65,13 @@ _tp_connection_contacts_changed_item_free (gpointer data) g_slice_free (ContactsChangedItem, item); } +void +_tp_connection_contacts_changed_queue_free (GQueue *queue) +{ + g_queue_foreach (queue, (GFunc) contacts_changed_item_free, NULL); + g_queue_free (queue); +} + static void process_queued_contacts_changed (TpConnection *self); static void @@ -121,7 +126,7 @@ contacts_changed_head_ready (TpConnection *self) g_ptr_array_unref (added); g_ptr_array_unref (removed); - _tp_connection_contacts_changed_item_free (item); + contacts_changed_item_free (item); process_queued_contacts_changed (self); } |