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
This commit is contained in:
Daiki Ueno 2015-12-22 11:21:56 +09:00 committed by Daiki Ueno
parent cc50652db5
commit 75b3eec7a6

View File

@ -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)
{