[gtk+/gtk-3-0] Do not leak list when drawing notebook.



commit 68c2bac9b154f6b02f70702bb0427eb2a7ccc330
Author: Paolo Borelli <pborelli gnome org>
Date:   Wed Apr 6 06:18:18 2011 +0200

    Do not leak list when drawing notebook.
    
    When we construct the list in the other order we must free it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=646886

 gtk/gtknotebook.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 5f7bddf..e03ed51 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -4904,7 +4904,7 @@ gtk_notebook_paint (GtkWidget    *widget,
   GtkNotebookPrivate *priv;
   GtkNotebookPage *page;
   GtkAllocation allocation;
-  GList *children, *other_order;
+  GList *children;
   gboolean showarrow;
   gint width, height;
   gint x, y;
@@ -5076,7 +5076,7 @@ gtk_notebook_paint (GtkWidget    *widget,
 
   if (children != NULL)
     {
-      other_order = NULL;
+      GList *other_order = NULL;
 
       while (children)
         {
@@ -5092,17 +5092,15 @@ gtk_notebook_paint (GtkWidget    *widget,
         }
 
       /* draw them with the opposite order */
-      children = other_order;
-
-      while (children)
+      for (children = other_order; children; children = children->next)
         {
           page = children->data;
 
           tab_flags = _gtk_notebook_get_tab_flags (notebook, page);
           gtk_notebook_draw_tab (notebook, page, cr, tab_flags);
-
-          children = children->next;
         }
+
+      g_list_free (other_order);
     }
 
   if (showarrow && priv->scrollable)



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