[gnome-online-accounts/wip/rishi/gtask: 2/2] httpclient: Be more strict about the GMainContext doing the clean up



commit 140d1b3b80243c9ff330f0bb87e329ce273f0063
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Jan 9 18:38:35 2017 +0100

    httpclient: Be more strict about the GMainContext doing the clean up
    
    The SoupSession is meant to be used with the thread-default
    GMainContext at the time of its creation. Destroying it from anywhere
    else will lead to crashes or deadlocks. Given that we are only using
    asynchronous operations, chances are very high that the thread-default
    context is the same in the SoupSessionCallback.
    
    However, let's not leave it to chance. Unlike GSimpleAsyncResult,
    GTask offers us a way to be absolutely sure. Let's take advantage of
    it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=743044
    https://bugzilla.gnome.org/show_bug.cgi?id=764157

 src/goabackend/goahttpclient.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/goabackend/goahttpclient.c b/src/goabackend/goahttpclient.c
index d75c406..52cc0f5 100644
--- a/src/goabackend/goahttpclient.c
+++ b/src/goabackend/goahttpclient.c
@@ -194,7 +194,7 @@ http_client_check_response_cb (SoupSession *session, SoupMessage *msg, gpointer
   g_source_set_callback (source, http_client_check_free_in_idle, task, NULL);
   g_source_set_name (source, "[goa] http_client_check_free_in_idle");
 
-  context = g_main_context_get_thread_default ();
+  context = g_task_get_context (task);
   g_source_attach (source, context);
   g_source_unref (source);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]