group: Handle list modification while destroying children
This makes the dispose code that destroys children resilient against priv->children being modified during child destruction.
This commit is contained in:
parent
1741c805be
commit
ddc9eb5fa5
@ -350,12 +350,14 @@ clutter_group_dispose (GObject *object)
|
|||||||
ClutterGroup *self = CLUTTER_GROUP (object);
|
ClutterGroup *self = CLUTTER_GROUP (object);
|
||||||
ClutterGroupPrivate *priv = self->priv;
|
ClutterGroupPrivate *priv = self->priv;
|
||||||
|
|
||||||
if (priv->children)
|
/* Note: we are careful to consider that destroying children could
|
||||||
|
* have the side-effect of destroying other children so
|
||||||
|
* priv->children may be modified during clutter_actor_destroy. */
|
||||||
|
while (priv->children)
|
||||||
{
|
{
|
||||||
g_list_foreach (priv->children, (GFunc) clutter_actor_destroy, NULL);
|
ClutterActor *child = priv->children->data;
|
||||||
g_list_free (priv->children);
|
priv->children = g_list_delete_link (priv->children, priv->children);
|
||||||
|
clutter_actor_destroy (child);
|
||||||
priv->children = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->layout)
|
if (priv->layout)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user