clutter-group: Use g_list_foreach in clutter_group_real_foreach

g_list_foreach has better protection against the current node being
removed. This will happen for example if someone calls
clutter_container_foreach(container, clutter_actor_destroy). This was
causing valgrind errors for the conformance tests which do just that.
This commit is contained in:
Neil Roberts 2010-01-18 12:35:05 +00:00
parent 3d373c7278
commit ce030a3fce

View File

@ -277,10 +277,12 @@ clutter_group_real_foreach (ClutterContainer *container,
{ {
ClutterGroup *group = CLUTTER_GROUP (container); ClutterGroup *group = CLUTTER_GROUP (container);
ClutterGroupPrivate *priv = group->priv; ClutterGroupPrivate *priv = group->priv;
GList *l;
for (l = priv->children; l; l = l->next) /* Using g_list_foreach instead of iterating the list manually
(* callback) (CLUTTER_ACTOR (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