actor: Make _clutter_actor_foreach_child() safe again
We were using g_list_foreach() prior to the first Apocalypse, and that function is resilient against changes to the list while iterating it; since we are not using a GList any more, we need handle this case ourselves.
This commit is contained in:
parent
656c641d31
commit
d45420f992
@ -15801,15 +15801,25 @@ _clutter_actor_foreach_child (ClutterActor *self,
|
|||||||
ClutterForeachCallback callback,
|
ClutterForeachCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
ClutterActorPrivate *priv = self->priv;
|
|
||||||
ClutterActor *iter;
|
ClutterActor *iter;
|
||||||
gboolean cont;
|
gboolean cont;
|
||||||
|
|
||||||
for (cont = TRUE, iter = priv->first_child;
|
if (self->priv->first_child == NULL)
|
||||||
cont && iter != NULL;
|
return TRUE;
|
||||||
iter = iter->priv->next_sibling)
|
|
||||||
|
cont = TRUE;
|
||||||
|
iter = self->priv->first_child;
|
||||||
|
|
||||||
|
/* we use this form so that it's safe to change the children
|
||||||
|
* list while iterating it
|
||||||
|
*/
|
||||||
|
while (cont && iter != NULL)
|
||||||
{
|
{
|
||||||
|
ClutterActor *next = iter->priv->next_sibling;
|
||||||
|
|
||||||
cont = callback (iter, user_data);
|
cont = callback (iter, user_data);
|
||||||
|
|
||||||
|
iter = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cont;
|
return cont;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user