[gnome-software/gnome-3-20] shell: Avoid destroying modal windows in the "response" signal handler



commit 81c67726cb9e3dd29c961cc857c6b5b43bf9bf45
Author: Kalev Lember <klember redhat com>
Date:   Tue Jun 7 15:25:40 2016 +0200

    shell: Avoid destroying modal windows in the "response" signal handler
    
    Other code may legitimately connect to the "response" signal handler as
    well and if we destroy it in the handler, their callbacks are never
    invoked. Instead, do our window tracking in the "unmap" signal handler.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764437

 src/gs-shell.c |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 73319a8..d3afcdd 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -89,17 +89,12 @@ enum {
 
 static guint signals [SIGNAL_LAST] = { 0 };
 
-/**
- * gs_shell_modal_dialog_present:
- **/
 static void
-gs_shell_modal_dialog_response_cb (GtkDialog *dialog,
-                                  gint response_id,
-                                  GsShell *shell)
+modal_dialog_unmapped_cb (GtkWidget *dialog,
+                          GsShell *shell)
 {
        GsShellPrivate *priv = gs_shell_get_instance_private (shell);
-       g_debug ("handling modal dialog response %i for %p",
-                response_id, dialog);
+       g_debug ("modal dialog %p unmapped", dialog);
        g_ptr_array_remove (priv->modal_dialogs, dialog);
 }
 
@@ -125,10 +120,10 @@ gs_shell_modal_dialog_present (GsShell *shell, GtkDialog *dialog)
 
        /* add to stack, transfer ownership to here */
        g_ptr_array_add (priv->modal_dialogs, dialog);
+       g_signal_connect (GTK_WIDGET (dialog), "unmap",
+                         G_CALLBACK (modal_dialog_unmapped_cb), shell);
 
        /* present the new one */
-       g_signal_connect (dialog, "response",
-                         G_CALLBACK (gs_shell_modal_dialog_response_cb), shell);
        gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
        gtk_window_present (GTK_WINDOW (dialog));
 }


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