diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2010-04-30 12:21:07 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-06-09 17:32:10 +0100 |
commit | 04fdc34897f911fbc572073f01e0b0196b1822cc (patch) | |
tree | 6b889aa09e0c1cfeeb3d34ba183c9635af2d07f5 | |
parent | 1ab374724ea8c64e46dd0b0ef8811dbe6a38458d (diff) |
Don't delay removing items from the roster.
I'm pretty sure the FIXME is correct: for each item, we hold a ref to
the handle in referenced_handles until the end of the function. So we
don't need to keep the items kicking around until the end of the
function just to keep the handles alive.
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r-- | src/roster.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/roster.c b/src/roster.c index b70a395df..cff710c08 100644 --- a/src/roster.c +++ b/src/roster.c @@ -1298,12 +1298,10 @@ process_roster ( GHashTable *group_update_table = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) _group_mem_update_destroy); TpHandleSet *referenced_handles = tp_handle_set_new (contact_repo); - GArray *removed = g_array_new (FALSE, FALSE, sizeof (TpHandle)); TpHandle handle; GabbleRosterChannel *pub_chan, *sub_chan, *chan; gboolean google_roster = FALSE; - guint i; NodeIter j; if (priv->conn->features & GABBLE_CONNECTION_FEATURES_GOOGLE_ROSTER) @@ -1489,12 +1487,9 @@ process_roster ( } } - /* delay removing items from roster until signals have been emitted; - * otherwise handles go out of scope! - * FIXME: this probably isn't true any more because of - * referenced_handles */ + /* Remove removed contacts from the roster. */ if (GABBLE_ROSTER_SUBSCRIPTION_REMOVE == item->subscription) - g_array_append_val (removed, handle); + _gabble_roster_item_remove (roster, handle); } DEBUG ("calling change members on publish channel"); @@ -1530,10 +1525,6 @@ process_roster ( tp_intset_destroy (deny_rem); } - for (i = 0; i < removed->len; i++) - _gabble_roster_item_remove (roster, - g_array_index (removed, TpHandle, i)); - tp_intset_destroy (pub_add); tp_intset_destroy (pub_rem); tp_intset_destroy (sub_add); @@ -1541,7 +1532,6 @@ process_roster ( tp_intset_destroy (sub_rp); tp_intset_destroy (stored_add); tp_intset_destroy (stored_rem); - g_array_free (removed, TRUE); g_hash_table_destroy (group_update_table); tp_handle_set_destroy (referenced_handles); } |