From 982c4a70b614a2b9c4b3d4190a64be9f408f35b5 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Wed, 12 Oct 2016 16:38:13 +0100 Subject: [PATCH] headerbar: fix leak of label_sizing_box Since the widget is not added to a container, we have the responsibility to sink the initial floating reference, and ultimately to unref it. https://bugzilla.gnome.org/show_bug.cgi?id=772859 --- gtk/gtkheaderbar.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c index 40f5d3dc65..e467326e2a 100644 --- a/gtk/gtkheaderbar.c +++ b/gtk/gtkheaderbar.c @@ -133,8 +133,9 @@ init_sizing_box (GtkHeaderBar *bar) * the real label box with its actual size, to keep it center-aligned * in case we have only the title. */ - priv->label_sizing_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_widget_show (priv->label_sizing_box); + w = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_widget_show (w); + priv->label_sizing_box = g_object_ref_sink (w); w = gtk_label_new (NULL); gtk_widget_show (w); @@ -1466,6 +1467,12 @@ gtk_header_bar_destroy (GtkWidget *widget) { GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (widget)); + if (priv->label_sizing_box) + { + gtk_widget_destroy (priv->label_sizing_box); + g_clear_object (&priv->label_sizing_box); + } + if (priv->custom_title) { gtk_widget_unparent (priv->custom_title);