[empathy] cope with the top_group_members list being changed while iterating over it
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] cope with the top_group_members list being changed while iterating over it
- Date: Tue, 2 Oct 2012 11:58:59 +0000 (UTC)
commit ee2b89a5cbd5b5837488c7334a259bc356eccdc4
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Tue Oct 2 13:47:27 2012 +0200
cope with the top_group_members list being changed while iterating over it
https://bugzilla.gnome.org/show_bug.cgi?id=685203
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 bd3eeeb..859edb7 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);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]