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
This commit is contained in:
parent
72fa44d0fd
commit
127ba318fd
@ -318,8 +318,11 @@ shell_polkit_authentication_agent_unregister (ShellPolkitAuthenticationAgent *ag
|
|||||||
if (agent->current_request != NULL)
|
if (agent->current_request != NULL)
|
||||||
auth_request_dismiss (agent->current_request);
|
auth_request_dismiss (agent->current_request);
|
||||||
|
|
||||||
polkit_agent_listener_unregister (agent->handle);
|
if (agent->handle)
|
||||||
agent->handle = NULL;
|
{
|
||||||
|
polkit_agent_listener_unregister (agent->handle);
|
||||||
|
agent->handle = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void maybe_process_next_request (ShellPolkitAuthenticationAgent *agent);
|
static void maybe_process_next_request (ShellPolkitAuthenticationAgent *agent);
|
||||||
|
Loading…
Reference in New Issue
Block a user