forked from AuroraMiddleware/gtk
headerbar: Don't leak internal widgets
Make sure to clean up internal widgets in destroy, as these aren't cleaned up when GtkContainer walks the childrens list in gtk_container_destroy(). This also fixes a gedit crash as reported in https://bugzilla.redhat.com/show_bug.cgi?id=1288669 https://bugzilla.gnome.org/show_bug.cgi?id=759132
This commit is contained in:
parent
7d1a0b075d
commit
9103707922
@ -1387,6 +1387,40 @@ gtk_header_bar_get_custom_title (GtkHeaderBar *bar)
|
||||
return priv->custom_title;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_header_bar_destroy (GtkWidget *widget)
|
||||
{
|
||||
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (widget));
|
||||
|
||||
if (priv->custom_title)
|
||||
{
|
||||
gtk_widget_unparent (priv->custom_title);
|
||||
priv->custom_title = NULL;
|
||||
}
|
||||
|
||||
if (priv->label_box)
|
||||
{
|
||||
gtk_widget_unparent (priv->label_box);
|
||||
priv->label_box = NULL;
|
||||
}
|
||||
|
||||
if (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_unparent (priv->titlebar_end_box);
|
||||
priv->titlebar_end_box = NULL;
|
||||
priv->titlebar_end_separator = NULL;
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_header_bar_parent_class)->destroy (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_header_bar_finalize (GObject *object)
|
||||
{
|
||||
@ -1842,6 +1876,7 @@ gtk_header_bar_class_init (GtkHeaderBarClass *class)
|
||||
object_class->get_property = gtk_header_bar_get_property;
|
||||
object_class->set_property = gtk_header_bar_set_property;
|
||||
|
||||
widget_class->destroy = gtk_header_bar_destroy;
|
||||
widget_class->size_allocate = gtk_header_bar_size_allocate;
|
||||
widget_class->get_preferred_width = gtk_header_bar_get_preferred_width;
|
||||
widget_class->get_preferred_height = gtk_header_bar_get_preferred_height;
|
||||
|
Loading…
Reference in New Issue
Block a user