[gtk/window-destroy: 17/18] Unset tooltip window earlier



commit d75907294df9b78576ac89786707fe775fdf433c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 9 16:46:40 2020 -0400

    Unset tooltip window earlier
    
    This avoids a crash when the tooltip window tries
    to update its action muxers.

 gtk/gtktooltip.c        | 14 ++++++++++++++
 gtk/gtktooltipprivate.h |  1 +
 gtk/gtkwindow.c         |  2 ++
 3 files changed, 17 insertions(+)
---
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index fc9e665444b..4af709f19ec 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -990,3 +990,17 @@ gtk_tooltip_maybe_allocate (GtkNative *native)
 
   gtk_native_check_resize (GTK_NATIVE (tooltip->window));
 }
+
+void
+gtk_tooltip_unset_surface (GtkNative *native)
+{
+  GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (native));
+  GtkTooltip *tooltip;
+
+  tooltip = g_object_get_qdata (G_OBJECT (display), quark_current_tooltip);
+  if (!tooltip || GTK_NATIVE (tooltip->native) != native)
+    return;
+
+  gtk_tooltip_set_surface (tooltip, NULL);
+}
+
diff --git a/gtk/gtktooltipprivate.h b/gtk/gtktooltipprivate.h
index ca63406b2c1..8f48433775b 100644
--- a/gtk/gtktooltipprivate.h
+++ b/gtk/gtktooltipprivate.h
@@ -44,6 +44,7 @@ GtkWidget * _gtk_widget_find_at_coords   (GdkSurface         *surface,
                                           gint               *widget_y);
 
 void gtk_tooltip_maybe_allocate          (GtkNative          *native);
+void gtk_tooltip_unset_surface           (GtkNative          *native);
 
 G_END_DECLS
 
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index c469ceb7d07..ce94190e44b 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7484,6 +7484,8 @@ gtk_window_destroy (GtkWindow *window)
 
   g_return_if_fail (GTK_IS_WINDOW (window));
 
+  gtk_tooltip_unset_surface (GTK_NATIVE (window));
+
   for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (toplevel_list)); i++)
     {
       gpointer item = g_list_model_get_item (G_LIST_MODEL (toplevel_list), i);


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