From 8ef4f7fd749bec85b2a6ec3602854fd769507c46 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Wed, 12 Oct 2016 18:03:43 +0100 Subject: [PATCH] headerbar: fix leak of start_box/end_box gtk_widget_destroy() removes widgets from their container. However _internal_ widgets must be unref'ed using gtk_widget_unparent() instead. This is symmetric with the fact that these widgets were ref'ed by direct call to gtk_widget_set_parent(). It's also the method that was used in gtk_headerbar_destroy(). https://bugzilla.gnome.org/show_bug.cgi?id=772859 --- gtk/gtkheaderbar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c index 51546754ee..ce67c10ba9 100644 --- a/gtk/gtkheaderbar.c +++ b/gtk/gtkheaderbar.c @@ -282,13 +282,13 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar) if (priv->titlebar_start_box) { - gtk_widget_destroy (priv->titlebar_start_box); + gtk_widget_unparent (priv->titlebar_start_box); priv->titlebar_start_box = NULL; priv->titlebar_start_separator = NULL; } if (priv->titlebar_end_box) { - gtk_widget_destroy (priv->titlebar_end_box); + gtk_widget_unparent (priv->titlebar_end_box); priv->titlebar_end_box = NULL; priv->titlebar_end_separator = NULL; }