From af9d932e47aeb858ae91670ddae62547add2f37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 18 Nov 2016 10:02:22 +0100 Subject: [PATCH] widget: Unparent widgets in dispose() If they have a non-container parent. --- gtk/gtkwidget.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index e481a729bd..1de5d2fa66 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -10382,8 +10382,10 @@ gtk_widget_dispose (GObject *object) GtkWidgetPrivate *priv = widget->priv; GSList *sizegroups; - if (priv->parent) + if (priv->parent && GTK_IS_CONTAINER (priv->parent)) gtk_container_remove (GTK_CONTAINER (priv->parent), widget); + else if (priv->parent) + gtk_widget_unparent (widget); else if (_gtk_widget_get_visible (widget)) gtk_widget_hide (widget);