summaryrefslogtreecommitdiff
path: root/gtk/gtkwindow.c
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@src.gnome.org>2015-12-22 11:21:56 +0900
committerDaiki Ueno <ueno@gnu.org>2015-12-22 12:52:27 +0900
commit75b3eec7a6549f0c2cf56d5b831c83aa939de3c7 (patch)
treed5f00b2d94af66e8e0c5ca89b831f2c2082ec4c5 /gtk/gtkwindow.c
parentcc50652db52d7b8ef8119592da6245978f9a0f31 (diff)
downloadgtk+-75b3eec7a6549f0c2cf56d5b831c83aa939de3c7.tar.gz
inspector: Avoid crash when canceling at startup
When clicking "Cancel" on the "Do you want to use GTK+ Inspector?" dialog, unregister the update_debugging idle handler. Also, steal reference to 'inspector_window' while gtk_destroy_widget(), to make further gtk_window_update_debugging() calls as a no-op. https://bugzilla.gnome.org/show_bug.cgi?id=759764
Diffstat (limited to 'gtk/gtkwindow.c')
-rw-r--r--gtk/gtkwindow.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index a513e6c1d0..d371ba3b26 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -12143,6 +12143,8 @@ _gtk_window_raise_popover (GtkWindow *window,
static GtkWidget *inspector_window = NULL;
+static guint gtk_window_update_debugging_id;
+
static void set_warn_again (gboolean warn);
static void
@@ -12159,8 +12161,19 @@ warn_response (GtkDialog *dialog,
g_object_set_data (G_OBJECT (inspector_window), "warning_dialog", NULL);
if (response == GTK_RESPONSE_NO)
{
- gtk_widget_destroy (inspector_window);
+ GtkWidget *window;
+
+ if (gtk_window_update_debugging_id)
+ {
+ g_source_remove (gtk_window_update_debugging_id);
+ gtk_window_update_debugging_id = 0;
+ }
+
+ /* Steal reference into temp variable, so not to mess up with
+ inspector_window during gtk_widget_destroy(). */
+ window = inspector_window;
inspector_window = NULL;
+ gtk_widget_destroy (window);
}
else
{
@@ -12168,8 +12181,6 @@ warn_response (GtkDialog *dialog,
}
}
-static guint gtk_window_update_debugging_id;
-
static gboolean
update_debugging (gpointer data)
{