box: port a ClutterGroup::foreach fix to ClutterBox

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.)
This commit is contained in:
Robert Bragg 2010-02-09 19:19:44 +00:00
parent 60a4664d6e
commit bfb271b403

View File

@ -171,8 +171,11 @@ clutter_box_real_foreach (ClutterContainer *container,
{ {
ClutterBoxPrivate *priv = CLUTTER_BOX (container)->priv; ClutterBoxPrivate *priv = CLUTTER_BOX (container)->priv;
for (l = priv->children; l != NULL; l = l->next) /* Using g_list_foreach instead of iterating the list manually
(* callback) (l->data, user_data); 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 static void