]> Pileus Git - ~andy/gtk/commitdiff
Do not leak list when drawing notebook.
authorPaolo Borelli <pborelli@gnome.org>
Wed, 6 Apr 2011 04:18:18 +0000 (06:18 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 9 Apr 2011 00:21:22 +0000 (20:21 -0400)
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

index 896703696ea9cb8210edc5721a79699744ef2350..f8f3d1303d43e1c3ff506db9055791ad82f052ac 100644 (file)
@@ -4921,7 +4921,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;
@@ -5093,7 +5093,7 @@ gtk_notebook_paint (GtkWidget    *widget,
 
   if (children != NULL)
     {
-      other_order = NULL;
+      GList *other_order = NULL;
 
       while (children)
         {
@@ -5109,17 +5109,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)