Commit 236fffc5 authored by Alberts Muktupāvels's avatar Alberts Muktupāvels
Browse files

screensaver: keep auth object alive long enough

Otherwise bad things can happen...
parent fb671efc
...@@ -403,9 +403,6 @@ verify_done_cb (GObject *object, ...@@ -403,9 +403,6 @@ verify_done_cb (GObject *object,
self = GF_AUTH (user_data); self = GF_AUTH (user_data);
if (!verified)
g_clear_object (&self->task);
message = ""; message = "";
if (error != NULL) if (error != NULL)
{ {
...@@ -440,6 +437,16 @@ verify_done_cb (GObject *object, ...@@ -440,6 +437,16 @@ verify_done_cb (GObject *object,
g_clear_error (&error); g_clear_error (&error);
} }
static void
task_finalized_cb (gpointer data,
GObject *where_the_object_was)
{
GfAuth *self;
self = GF_AUTH (data);
self->task = NULL;
}
static void static void
gf_auth_dispose (GObject *object) gf_auth_dispose (GObject *object)
{ {
...@@ -458,13 +465,10 @@ gf_auth_dispose (GObject *object) ...@@ -458,13 +465,10 @@ gf_auth_dispose (GObject *object)
self->message_id = 0; self->message_id = 0;
} }
if (self->awaits_response) g_assert (!self->awaits_response);
g_cond_signal (&self->cond);
g_mutex_unlock (&self->mutex); g_mutex_unlock (&self->mutex);
g_clear_object (&self->task);
G_OBJECT_CLASS (gf_auth_parent_class)->dispose (object); G_OBJECT_CLASS (gf_auth_parent_class)->dispose (object);
} }
...@@ -630,7 +634,17 @@ gf_auth_verify (GfAuth *self) ...@@ -630,7 +634,17 @@ gf_auth_verify (GfAuth *self)
return; return;
self->task = g_task_new (NULL, self->cancellable, verify_done_cb, self); self->task = g_task_new (NULL, self->cancellable, verify_done_cb, self);
g_task_set_task_data (self->task, self, NULL); g_task_set_task_data (self->task, g_object_ref (self), g_object_unref);
g_object_weak_ref (G_OBJECT (self->task), task_finalized_cb, self);
g_task_run_in_thread (self->task, verify_in_thread_cb); g_task_run_in_thread (self->task, verify_in_thread_cb);
g_object_unref (self->task);
}
void
gf_auth_cancel (GfAuth *self)
{
g_cancellable_cancel (self->cancellable);
gf_auth_set_response (self, NULL);
} }
...@@ -52,6 +52,8 @@ void gf_auth_set_response (GfAuth *self, ...@@ -52,6 +52,8 @@ void gf_auth_set_response (GfAuth *self,
void gf_auth_verify (GfAuth *self); void gf_auth_verify (GfAuth *self);
void gf_auth_cancel (GfAuth *self);
G_END_DECLS G_END_DECLS
#endif #endif
...@@ -818,7 +818,13 @@ gf_unlock_dialog_dispose (GObject *object) ...@@ -818,7 +818,13 @@ gf_unlock_dialog_dispose (GObject *object)
g_clear_object (&self->dm_seat); g_clear_object (&self->dm_seat);
g_clear_object (&self->login_seat); g_clear_object (&self->login_seat);
g_clear_object (&self->auth); if (self->auth != NULL)
{
gf_auth_cancel (self->auth);
g_object_unref (self->auth);
self->auth = NULL;
}
G_OBJECT_CLASS (gf_unlock_dialog_parent_class)->dispose (object); G_OBJECT_CLASS (gf_unlock_dialog_parent_class)->dispose (object);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment