st-widget: fix GList leak

clutter_actor_get_children returns a newly allocated GList and it was
not freed.

However, as there's no reason to copy the children list, switch to
iterator api.

https://bugzilla.gnome.org/show_bug.cgi?id=678406
This commit is contained in:
Pavel Vasin 2012-06-18 21:11:28 +04:00 committed by Jasper St. Pierre
parent 4e4092f9e8
commit 556d5d181e

View File

@ -762,18 +762,17 @@ st_widget_get_paint_volume (ClutterActor *self,
static GList *
st_widget_real_get_focus_chain (StWidget *widget)
{
GList *children;
ClutterActorIter iter;
ClutterActor *child;
GList *focus_chain = NULL;
for (children = clutter_actor_get_children (CLUTTER_ACTOR (widget));
children;
children = children->next)
clutter_actor_iter_init (&iter, CLUTTER_ACTOR (widget));
while (clutter_actor_iter_next (&iter, &child))
{
ClutterActor *child = children->data;
if (CLUTTER_ACTOR_IS_VISIBLE (child))
focus_chain = g_list_prepend (focus_chain, child);
}
return g_list_reverse (focus_chain);
}