[gtk+/gtk-3-22] headerbar: fix leak of separator



commit 3eb53e9e7c31f47b2dad472437abe650ba11ee04
Author: Alan Jenkins <alan christopher jenkins gmail com>
Date:   Wed Oct 12 16:18:47 2016 +0100

    headerbar: fix leak of separator
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772859

 gtk/gtkheaderbar.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index ce67c10..40f5d3d 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -340,11 +340,6 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
           gtk_widget_set_no_show_all (separator, TRUE);
           gtk_style_context_add_class (gtk_widget_get_style_context (separator), "titlebutton");
 
-          if (i == 0)
-            priv->titlebar_start_separator = separator;
-          else
-            priv->titlebar_end_separator = separator;
-
           box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, priv->spacing);
 
           for (j = 0; t[j]; j++)
@@ -460,6 +455,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
           if (n_children == 0)
             {
               gtk_widget_destroy (box);
+              gtk_widget_destroy (separator);
               continue;
             }
 
@@ -487,9 +483,15 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
           gtk_widget_set_parent (box, GTK_WIDGET (bar));
 
           if (i == 0)
-            priv->titlebar_start_box = box;
+            {
+              priv->titlebar_start_box = box;
+              priv->titlebar_start_separator = separator;
+            }
           else
-            priv->titlebar_end_box = box;
+            {
+              priv->titlebar_end_box = box;
+              priv->titlebar_end_separator = separator;
+            }
         }
       g_strfreev (tokens);
     }


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