From ce030a3fce362cf4238d361743aaf9027ceed95a Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Mon, 18 Jan 2010 12:35:05 +0000 Subject: [PATCH] clutter-group: Use g_list_foreach in clutter_group_real_foreach g_list_foreach has better protection against the current node being removed. This will happen for example if someone calls clutter_container_foreach(container, clutter_actor_destroy). This was causing valgrind errors for the conformance tests which do just that. --- clutter/clutter-group.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/clutter/clutter-group.c b/clutter/clutter-group.c index a0ef32c05..059931634 100644 --- a/clutter/clutter-group.c +++ b/clutter/clutter-group.c @@ -277,10 +277,12 @@ clutter_group_real_foreach (ClutterContainer *container, { ClutterGroup *group = CLUTTER_GROUP (container); ClutterGroupPrivate *priv = group->priv; - GList *l; - for (l = priv->children; l; l = l->next) - (* callback) (CLUTTER_ACTOR (l->data), user_data); + /* Using g_list_foreach instead of iterating the list manually + because it has better protection against the current node being + removed. This will happen for example if someone calls + clutter_container_foreach(container, clutter_actor_destroy) */ + g_list_foreach (priv->children, (GFunc) callback, user_data); } static void