[goffice] GOOptionMenu: another gtk_container_get_children leak.



commit 3315c3508c9aed5bfc24b9ace5c0f78c55481f6d
Author: Morten Welinder <terra gnome org>
Date:   Fri Mar 22 15:37:53 2013 -0400

    GOOptionMenu: another gtk_container_get_children leak.

 ChangeLog                   |    5 +++++
 NEWS                        |    1 +
 goffice/gtk/go-optionmenu.c |    7 ++++---
 3 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e8d8338..b0fd208 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-22  Morten Welinder  <terra gnome org>
+
+       * goffice/gtk/go-optionmenu.c (go_option_menu_position): Plug
+       leak.
+
 2013-03-21  Morten Welinder  <terra gnome org>
 
        * goffice/gtk/go-optionmenu.c (go_option_menu_build): New
diff --git a/NEWS b/NEWS
index 1b25abb..ea8554c 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Morten:
        * Add dialog version of the font selector.
        * Rewrite font selector.  [#695031]
        * Fix GOComboColor signal problem.  [#696022]
+       * Plug leaks.
 
 --------------------------------------------------------------------------
 goffice 0.10.1:
diff --git a/goffice/gtk/go-optionmenu.c b/goffice/gtk/go-optionmenu.c
index d1c70c7..9c053bd 100644
--- a/goffice/gtk/go-optionmenu.c
+++ b/goffice/gtk/go-optionmenu.c
@@ -154,7 +154,7 @@ go_option_menu_position (GtkMenu  *menu,
        GOOptionMenu *option_menu = user_data;
        GtkWidget *widget;
        GtkRequisition requisition;
-       GList *children;
+       GList *children, *l;
        gint screen_width;
        gint menu_xpos;
        gint menu_ypos;
@@ -173,8 +173,8 @@ go_option_menu_position (GtkMenu  *menu,
        menu_ypos += allocation.y + allocation.height / 2 - 2;
 
        children = gtk_container_get_children (GTK_CONTAINER (option_menu->menu));
-       while (children) {
-               GtkWidget *child = children->data;
+       for (l = children; l; l = l->next) {
+               GtkWidget *child = l->data;
 
                if (child == (GtkWidget*)option_menu->selected) {
                        gtk_widget_get_preferred_size (child, &requisition, NULL);
@@ -189,6 +189,7 @@ go_option_menu_position (GtkMenu  *menu,
 
                children = children->next;
        }
+       g_list_free (children);
 
        screen_width = gdk_screen_get_width (gtk_widget_get_screen (widget));
 


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