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,9 +318,12 @@ 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);
|
||||||
|
|
||||||
|
if (agent->handle)
|
||||||
|
{
|
||||||
polkit_agent_listener_unregister (agent->handle);
|
polkit_agent_listener_unregister (agent->handle);
|
||||||
agent->handle = NULL;
|
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