summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2018-03-22 11:11:38 -0300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2018-03-22 11:11:38 -0300
commitb0ff6613e6745ab7d8ef00bf3c9768683978be9c (patch)
tree3fa5601239e5f87483a66ab6e8e9f8913e337c32
parent4c19630586fbdb48b598ccabe891962c585d66c0 (diff)
downloadgnome-shell-gbsneto/polkit-fixup.tar.gz
polkit: Only unregister registered handlesgbsneto/polkit-fixup
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.
-rw-r--r--src/shell-polkit-authentication-agent.c7
1 files 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);