[gtk/matthiasc/for-master] widget: work around teardown ordering issues



commit f7f82f0b6cd592345cfeabf8fca89847d336b15a
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 10 17:02:17 2020 -0400

    widget: work around teardown ordering issues
    
    Many widgets do things on unmap; with us propagating
    disposal more eagerly, we now end up in a situation where
    widgets are already half-disposed when we reach the
    widget dispose() implementation which unmaps, unroots
    and unparents the widget. Work around this problem by
    unmapping first thing in gtk_widget_destroy() - that
    ensures that the widget is still intact when unmap()
    is run.
    
    This was causing crashes in several widgets such as
    GtkStack, GtkFontChooserWidget or GtkScrolledWindow.

 gtk/gtkwidget.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 2604a5856b..f3a399e817 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -2631,6 +2631,8 @@ gtk_widget_destroy (GtkWidget *widget)
 
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
+  gtk_widget_unmap (widget);
+
   if (!priv->in_destruction)
     g_object_run_dispose (G_OBJECT (widget));
 }


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