ClutterGroup::foreach was recently changed (ref:
ce030a3fce) to use
g_list_foreach() to iterate the children instead of manually iterating
the list so it would safely handle calls like:
clutter_container_foreach (container, clutter_actor_destroy);
(In this example clutter_actor_destroy will result in the current
list item being iterated being freed.)
{
ClutterBoxPrivate *priv = CLUTTER_BOX (container)->priv;
- for (l = priv->children; l != NULL; l = l->next)
- (* callback) (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