[gnome-software] shell: Avoid destroying modal windows in the "response" signal handler
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] shell: Avoid destroying modal windows in the "response" signal handler
- Date: Tue, 7 Jun 2016 13:51:31 +0000 (UTC)
commit 6a97322d8c3a85af1ad9804ceebedbe9f1015a03
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 5c4595d..0f77cbc 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -93,17 +93,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);
}
@@ -129,10 +124,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]