[gnome-keyring/gnome-3-2] ui: Fix problem with 'unsafe storage' prompt deadlocking
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring/gnome-3-2] ui: Fix problem with 'unsafe storage' prompt deadlocking
- Date: Mon, 14 Nov 2011 07:56:12 +0000 (UTC)
commit 15bf6c05a9ed4148ed212735a735c2fbe7289908
Author: Stef Walter <stefw collabora co uk>
Date: Mon Nov 14 08:54:50 2011 +0100
ui: Fix problem with 'unsafe storage' prompt deadlocking
* The grab handler wasn't being removed before showing the
'unsafe storage' prompt.
* This deadlock would occur when the user pressed <Enter> in
a password field.
https://bugzilla.gnome.org/show_bug.cgi?id=661277
ui/gku-prompt-tool.c | 18 ++++++++++++------
ui/tests/files/prompt-create | 12 ++++++++++++
2 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/ui/gku-prompt-tool.c b/ui/gku-prompt-tool.c
index c719b23..a0f18e7 100644
--- a/ui/gku-prompt-tool.c
+++ b/ui/gku-prompt-tool.c
@@ -62,6 +62,14 @@ static gsize n_the_key = 0;
#define LOG_ERRORS 1
#define GRAB_KEYBOARD 1
+static gboolean grab_keyboard (GtkWidget *win,
+ GdkEvent *event,
+ gpointer unused);
+
+static gboolean ungrab_keyboard (GtkWidget *win,
+ GdkEvent *event,
+ gpointer unused);
+
/**
* SECTION: gku-prompt-tool.c
* @short_description: Displays a propmt for 3rd party programs (ssh, gnupg)
@@ -108,9 +116,7 @@ grab_status_message (GdkGrabStatus status)
static gboolean
on_grab_broken (GtkWidget * widget, GdkEventGrabBroken * event)
{
- if (grabbed_device && event->keyboard)
- grabbed_device = NULL;
-
+ ungrab_keyboard (widget, (GdkEvent *)event, NULL);
return TRUE;
}
@@ -145,11 +151,11 @@ grab_keyboard (GtkWidget *win, GdkEvent *event, gpointer unused)
at = event ? gdk_event_get_time (event) : GDK_CURRENT_TIME;
status = gdk_device_grab (device, gtk_widget_get_window (win),
- GDK_OWNERSHIP_WINDOW, TRUE,
- GDK_KEY_PRESS | GDK_KEY_RELEASE, NULL, at);
+ GDK_OWNERSHIP_APPLICATION, TRUE,
+ GDK_KEY_PRESS | GDK_KEY_RELEASE, NULL, at);
if (status == GDK_GRAB_SUCCESS) {
grab_broken_id = g_signal_connect (win, "grab-broken-event",
- G_CALLBACK (on_grab_broken), NULL);
+ G_CALLBACK (on_grab_broken), NULL);
gtk_device_grab_add (win, device, TRUE);
grabbed_device = device;
} else {
diff --git a/ui/tests/files/prompt-create b/ui/tests/files/prompt-create
new file mode 100644
index 0000000..07a2573
--- /dev/null
+++ b/ui/tests/files/prompt-create
@@ -0,0 +1,12 @@
+[prompt]
+title=New Password
+primary=Enter a new password here
+secondary=This is a test of the new password prompt
+window-id=
+
+[visibility]
+name_area=false
+password_area=true
+confirm_area=true
+details_area=true
+options_area=true
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]