From 0d1777426d7b742aa8e07f4864324d66ce9fea84 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 4 Jul 2007 12:29:50 +0000 Subject: [PATCH] Fix the iteration in clutter_group_remove_all() When iterating on a list while changing it, it's a good idea to keep pointers around to avoid dirty access bugs. --- clutter/clutter-group.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/clutter/clutter-group.c b/clutter/clutter-group.c index a879f4fcf..9073e1bc8 100644 --- a/clutter/clutter-group.c +++ b/clutter/clutter-group.c @@ -265,7 +265,6 @@ clutter_group_real_remove (ClutterContainer *container, clutter_actor_queue_redraw (CLUTTER_ACTOR (group)); g_object_unref (actor); - } static void @@ -454,13 +453,15 @@ clutter_group_remove (ClutterGroup *group, void clutter_group_remove_all (ClutterGroup *group) { - GList *l; + GList *children; g_return_if_fail (CLUTTER_IS_GROUP (group)); - for (l = group->priv->children; l; l = l->next) + children = group->priv->children; + while (children) { - ClutterActor *child = l->data; + ClutterActor *child = children->data; + children = children->next; clutter_container_remove_actor (CLUTTER_CONTAINER (group), child); }