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.
This commit is contained in:
parent
82860b5d5a
commit
0d1777426d
@ -265,7 +265,6 @@ clutter_group_real_remove (ClutterContainer *container,
|
|||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (group));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (group));
|
||||||
|
|
||||||
g_object_unref (actor);
|
g_object_unref (actor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -454,13 +453,15 @@ clutter_group_remove (ClutterGroup *group,
|
|||||||
void
|
void
|
||||||
clutter_group_remove_all (ClutterGroup *group)
|
clutter_group_remove_all (ClutterGroup *group)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *children;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_GROUP (group));
|
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);
|
clutter_container_remove_actor (CLUTTER_CONTAINER (group), child);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user