diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-10-02 19:47:27 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-10-02 19:58:38 +0800 |
commit | ee2b89a5cbd5b5837488c7334a259bc356eccdc4 (patch) | |
tree | 252e82623914bcc90ee7c979a0657ebe93608fb4 | |
parent | f72a036cce9ff7ce9d1e96f7c72e42e83c8c4452 (diff) | |
download | gsoc2013-empathy-ee2b89a5cbd5b5837488c7334a259bc356eccdc4.tar gsoc2013-empathy-ee2b89a5cbd5b5837488c7334a259bc356eccdc4.tar.gz gsoc2013-empathy-ee2b89a5cbd5b5837488c7334a259bc356eccdc4.tar.bz2 gsoc2013-empathy-ee2b89a5cbd5b5837488c7334a259bc356eccdc4.tar.lz gsoc2013-empathy-ee2b89a5cbd5b5837488c7334a259bc356eccdc4.tar.xz gsoc2013-empathy-ee2b89a5cbd5b5837488c7334a259bc356eccdc4.tar.zst gsoc2013-empathy-ee2b89a5cbd5b5837488c7334a259bc356eccdc4.zip |
cope with the top_group_members list being changed while iterating over it
https://bugzilla.gnome.org/show_bug.cgi?id=685203
-rw-r--r-- | libempathy-gtk/empathy-roster-model-manager.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/libempathy-gtk/empathy-roster-model-manager.c b/libempathy-gtk/empathy-roster-model-manager.c index bd3eeeb00..859edb7a9 100644 --- a/libempathy-gtk/empathy-roster-model-manager.c +++ b/libempathy-gtk/empathy-roster-model-manager.c @@ -195,15 +195,22 @@ top_individuals_changed_cb (EmpathyIndividualManager *manager, EMPATHY_ROSTER_MODEL_GROUP_TOP_GROUP, TRUE); } } - for (l = self->priv->top_group_members; l != NULL; l = g_list_next (l)) + + l = self->priv->top_group_members; + while (l != NULL) { - if (!individual_should_be_in_top_group_members (self, l->data)) + FolksIndividual *individual = l->data; + + /* remove_from_top_group_members will modify the list so we already take + * the next pointer. */ + l = g_list_next (l); + + if (!individual_should_be_in_top_group_members (self, individual)) { - remove_from_top_group_members (self, l->data); + remove_from_top_group_members (self, individual); - empathy_roster_model_fire_groups_changed ( - EMPATHY_ROSTER_MODEL (self), l->data, - EMPATHY_ROSTER_MODEL_GROUP_TOP_GROUP, FALSE); + empathy_roster_model_fire_groups_changed (EMPATHY_ROSTER_MODEL (self), + individual, EMPATHY_ROSTER_MODEL_GROUP_TOP_GROUP, FALSE); } } } |