[gnome-software/wip/ubuntu-xenial] shell: Avoid destroying modal windows in the "response" signal handler
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/ubuntu-xenial] shell: Avoid destroying modal windows in the "response" signal handler
- Date: Wed, 8 Jun 2016 14:16:00 +0000 (UTC)
commit 6fbada8bb5d19df1a21f15a985f10770af7546e6
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 9e955d0..989df4b 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]