From 9e5b93460321fb2ab967eab280615a6f25dee883 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Sun, 7 Nov 2010 15:15:08 -0500 Subject: [PATCH] Fix weird dialog shown during login from GDM When the session manager enters the query end session phase, it temporarily adds all clients to the "query clients" list. This list is used to track the progression of clients quitting. If a client quits during the query end session phase instead of waiting until the end session phase, then it will get destroyed but not get removed from the query clients list. This commit removes it from the query clients list in this case. It does this by explicitly invoking the end session response handler (in effect, the client responded to the end session query by exiting). This prevents a bizarre bug people are seeing where they have to click "log out" in a dialog during the login process. https://bugzilla.gnome.org/show_bug.cgi?id=634244 --- gnome-session.spec | 10 +- prevent-inhibitor-dialog.patch | 184 +++++++++++++++++++++++++++++++++ 2 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 prevent-inhibitor-dialog.patch diff --git a/gnome-session.spec b/gnome-session.spec index a6ba9fc..e5a9ff6 100644 --- a/gnome-session.spec +++ b/gnome-session.spec @@ -5,7 +5,7 @@ Summary: GNOME session manager Name: gnome-session Version: 2.91.0 -Release: 5%{?dist} +Release: 6%{?dist} URL: http://www.gnome.org #VCS: git:git://git.gnome.org/gnome-session Source0: http://download.gnome.org/sources/gnome-session/2.91/%{name}-%{version}.tar.bz2 @@ -67,6 +67,9 @@ Patch3: 0001-Add-ability-to-perform-actions-after-a-period-of-idl.patch # https://bugzilla.gnome.org/show_bug.cgi?id=607094 Patch4: nag-root-user.patch +# https://bugzilla.gnome.org/show_bug.cgi?id=634244 +Patch5: prevent-inhibitor-dialog.patch + # Fedora specific patch Patch7: gnome-session-cflags.patch @@ -89,6 +92,7 @@ Desktop file to add GNOME to display manager session menu. %setup -q %patch3 -p1 -b .max-idle %patch4 -p1 -b .nag-root-user +%patch5 -p1 -b .prevent-inhibitor-dialog %patch7 -p1 -b .cflags @@ -172,6 +176,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %changelog +* Sun Nov 07 2010 Ray Strode 2.91.0-6 +- Fix some cases where the inhibitor dialog shows up when it isn't + supposed to. + * Tue Nov 2 2010 Matthias Clasen - 2.91.0-5 - Prepare for libnotify 0.7.0 diff --git a/prevent-inhibitor-dialog.patch b/prevent-inhibitor-dialog.patch new file mode 100644 index 0000000..4f0897b --- /dev/null +++ b/prevent-inhibitor-dialog.patch @@ -0,0 +1,184 @@ +From bf1b6e8843b5e72d4f5a62a34eb322b82e33c2df Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Sun, 7 Nov 2010 11:49:33 -0500 +Subject: [PATCH 1/2] manager: don't ever show inhibitor dialog if logout is forced + +If logout is forced, we don't want to show the inhibitor dialog. +A forced logout is one that shouldn't be "cancelable". + +This commit prevents inhibitors from getting added if logout is +forced. +--- + gnome-session/gsm-manager.c | 24 +++++++++++++++++++++--- + 1 files changed, 21 insertions(+), 3 deletions(-) + +diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c +index c85cea6..d15402f 100644 +--- a/gnome-session/gsm-manager.c ++++ b/gnome-session/gsm-manager.c +@@ -1193,6 +1193,12 @@ _on_query_end_session_timeout (GsmManager *manager) + g_warning ("Client '%s' failed to reply before timeout", + gsm_client_peek_id (l->data)); + ++ /* Don't add "not responding" inhibitors if logout is forced ++ */ ++ if (manager->priv->forceful_logout) { ++ continue; ++ } ++ + /* Add JIT inhibit for unresponsive client */ + if (GSM_IS_DBUS_CLIENT (l->data)) { + bus_name = gsm_dbus_client_get_bus_name (l->data); +@@ -1248,8 +1254,8 @@ do_phase_query_end_session (GsmManager *manager) + (GsmStoreFunc)_client_query_end_session, + &data); + +- /* This phase doesn't time out. This separate timer is only used to +- * show UI. */ ++ /* This phase doesn't time out unless logout is forced. Typically, this ++ * separate timer is only used to show UI. */ + manager->priv->query_timeout_id = g_timeout_add_seconds (1, (GSourceFunc)_on_query_end_session_timeout, manager); + } + +@@ -1877,7 +1883,7 @@ on_client_end_session_response (GsmClient *client, + + manager->priv->query_clients = g_slist_remove (manager->priv->query_clients, client); + +- if (! is_ok) { ++ if (! is_ok && !manager->priv->forceful_logout) { + guint cookie; + GsmInhibitor *inhibitor; + char *app_id; +@@ -3172,6 +3178,18 @@ gsm_manager_inhibit (GsmManager *manager, + reason, + flags); + ++ if (manager->priv->forceful_logout) { ++ GError *new_error; ++ ++ new_error = g_error_new (GSM_MANAGER_ERROR, ++ GSM_MANAGER_ERROR_GENERAL, ++ "Forced logout cannot be inhibited"); ++ g_debug ("GsmManager: Unable to inhibit: %s", new_error->message); ++ dbus_g_method_return_error (context, new_error); ++ g_error_free (new_error); ++ return FALSE; ++ } ++ + if (IS_STRING_EMPTY (app_id)) { + GError *new_error; + +-- +1.7.3.1 + + +From 8e6afcf1789c02692cf3b1ff3ee0a792d57e17a3 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Sun, 7 Nov 2010 12:32:17 -0500 +Subject: [PATCH 2/2] manager: remove client from query clients list on disconnect + +When the session manager enters the query end session phase, +it temporarily adds all clients to the "query clients" list. + +This list is used to track the progression of clients quitting. + +If a client quits during the query end session phase instead of +waiting until the end session phase, then it will get destroyed +but not get removed from the query clients list. + +This commit removes it from the query clients list in +this case. It does this by explicitly invoking the end session +response handler (in effect, the client responded to the end +session query by exiting). +--- + gnome-session/gsm-manager.c | 53 ++++++++++++++++++++++++++++++++++++++----- + 1 files changed, 47 insertions(+), 6 deletions(-) + +diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c +index d15402f..d1fecb9 100644 +--- a/gnome-session/gsm-manager.c ++++ b/gnome-session/gsm-manager.c +@@ -164,6 +164,13 @@ static void gsm_manager_finalize (GObject *object); + static gboolean auto_save_is_enabled (GsmManager *manager); + static void maybe_save_session (GsmManager *manager); + ++static void _handle_client_end_session_response (GsmManager *manager, ++ GsmClient *client, ++ gboolean is_ok, ++ gboolean do_last, ++ gboolean cancel, ++ const char *reason); ++ + static gpointer manager_object = NULL; + + G_DEFINE_TYPE (GsmManager, gsm_manager, G_TYPE_OBJECT) +@@ -1516,6 +1523,24 @@ _disconnect_client (GsmManager *manager, + } + } + ++ if (manager->priv->phase == GSM_MANAGER_PHASE_QUERY_END_SESSION) { ++ /* Instead of answering our end session query, the client just exited. ++ * Treat that as an "okay, end the session" answer. ++ * ++ * This call implicitly removes any inhibitors for the client, along ++ * with removing the client from the pending query list. ++ */ ++ _handle_client_end_session_response (manager, ++ client, ++ TRUE, ++ FALSE, ++ FALSE, ++ "Client exited in " ++ "query end session phase " ++ "instead of end session " ++ "phase"); ++ } ++ + if (app == NULL) { + g_debug ("GsmManager: unable to find application for client - not restarting"); + goto out; +@@ -1862,12 +1887,12 @@ out: + } + + static void +-on_client_end_session_response (GsmClient *client, +- gboolean is_ok, +- gboolean do_last, +- gboolean cancel, +- const char *reason, +- GsmManager *manager) ++_handle_client_end_session_response (GsmManager *manager, ++ GsmClient *client, ++ gboolean is_ok, ++ gboolean do_last, ++ gboolean cancel, ++ const char *reason) + { + /* just ignore if received outside of shutdown */ + if (manager->priv->phase < GSM_MANAGER_PHASE_QUERY_END_SESSION) { +@@ -1952,6 +1977,22 @@ on_client_end_session_response (GsmClient *client, + } + + static void ++on_client_end_session_response (GsmClient *client, ++ gboolean is_ok, ++ gboolean do_last, ++ gboolean cancel, ++ const char *reason, ++ GsmManager *manager) ++{ ++ _handle_client_end_session_response (manager, ++ client, ++ is_ok, ++ do_last, ++ cancel, ++ reason); ++} ++ ++static void + on_xsmp_client_logout_request (GsmXSMPClient *client, + gboolean show_dialog, + GsmManager *manager) +-- +1.7.3.1 +