shell: Fix crash in polkit agent

The polkit agent does not take ownership of the request's cancellable,
so it may no longer be valid after the request finished and we need
to disconnect it before that. Before the GTask port in 8b4249ef2,
it was safe to do that when freeing the request data because requests
completed in an idle, but now we need to do it before returning the
task result.

https://bugzilla.gnome.org/show_bug.cgi?id=757668
This commit is contained in:
Florian Müllner 2015-11-06 12:21:48 +01:00
parent df6b31de05
commit c634718dfa

View File

@ -207,7 +207,6 @@ struct _AuthRequest {
static void
auth_request_free (AuthRequest *request)
{
g_cancellable_disconnect (request->cancellable, request->handler_id);
g_free (request->action_id);
g_free (request->message);
g_free (request->icon_name);
@ -345,6 +344,7 @@ auth_request_complete (AuthRequest *request,
if (!is_current)
agent->scheduled_requests = g_list_remove (agent->scheduled_requests, request);
g_cancellable_disconnect (request->cancellable, request->handler_id);
if (dismissed)
g_task_return_new_error (request->simple,