summaryrefslogtreecommitdiff
path: root/telepathy-glib/connection-contact-list.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2011-08-17 11:30:08 +0200
committerXavier Claessens <xclaesse@gmail.com>2011-08-17 11:30:08 +0200
commit7da2779fd1b6d4da62a7d92efed4321e1078b612 (patch)
treedefad26b3ac916c902bda751ec3a3b86efc580ec /telepathy-glib/connection-contact-list.c
parent236aa055896672319ede0ee5f3f672a77c0dea97 (diff)
downloadtelepathy-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.c15
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);
}