[gnome-shell/gbsneto/polkit-fixup] polkit: Only unregister registered handles
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/polkit-fixup] polkit: Only unregister registered handles
- Date: Tue, 6 Nov 2018 15:04:23 +0000 (UTC)
commit aeabebe5b3d3231ab4a8e83f65d3d1d70ea218a4
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Mar 22 11:11:38 2018 -0300
polkit: Only unregister registered handles
If the initialization fails for some reason, for example by
running 'gnome-shell --replace', we should not crash because
of an attempt of unregistering an unregistered agent handle.
Fix that by checking if the handle is not NULL before calling
the unregistering routines.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/66
src/shell-polkit-authentication-agent.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/shell-polkit-authentication-agent.c b/src/shell-polkit-authentication-agent.c
index fd6c7913b..bca967fa1 100644
--- a/src/shell-polkit-authentication-agent.c
+++ b/src/shell-polkit-authentication-agent.c
@@ -318,8 +318,11 @@ shell_polkit_authentication_agent_unregister (ShellPolkitAuthenticationAgent *ag
if (agent->current_request != NULL)
auth_request_dismiss (agent->current_request);
- polkit_agent_listener_unregister (agent->handle);
- agent->handle = NULL;
+ if (agent->handle)
+ {
+ polkit_agent_listener_unregister (agent->handle);
+ agent->handle = NULL;
+ }
}
static void maybe_process_next_request (ShellPolkitAuthenticationAgent *agent);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]