[gtk] inspector: Properly clean up



commit 12c4766dd0c130f6177158c6a9d76b01d1d7bb0f
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Apr 2 21:19:50 2019 +0000

    inspector: Properly clean up
    
    I got a crash in inspector code when I hit
    cancel in the confirmation dialog for it.

 gtk/inspector/window.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c
index 191bbb90b3..3dc4475742 100644
--- a/gtk/inspector/window.c
+++ b/gtk/inspector/window.c
@@ -258,6 +258,14 @@ gtk_inspector_window_constructed (GObject *object)
   g_object_set_data (G_OBJECT (gdk_display_get_default ()), "-gtk-inspector", iw);
 }
 
+static void
+gtk_inspector_window_dispose (GObject *object)
+{
+  g_object_set_data (G_OBJECT (gdk_display_get_default ()), "-gtk-inspector", NULL);
+
+  G_OBJECT_CLASS (gtk_inspector_window_parent_class)->dispose (object);
+}
+
 static void
 object_details_changed (GtkWidget          *combo,
                         GParamSpec         *pspec,
@@ -284,6 +292,7 @@ gtk_inspector_window_class_init (GtkInspectorWindowClass *klass)
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
   object_class->constructed = gtk_inspector_window_constructed;
+  object_class->dispose = gtk_inspector_window_dispose;
   widget_class->realize = gtk_inspector_window_realize;
 
   g_signal_new (g_intern_static_string ("event"),


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