[gnome-shell] st-widget: fix GList leak



commit 556d5d181e8bab9365a5ef69f18965648e2b406b
Author: Pavel Vasin <rat4vier gmail com>
Date:   Mon Jun 18 21:11:28 2012 +0400

    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

 src/st/st-widget.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index 88d05c1..9546c1c 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -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);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]