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



commit 7b55b4daed72e677ecf211ef0604029a92ef32e8
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 ba934f8..e2a1f59 100644
--- a/src/goabackend/goahttpclient.c
+++ b/src/goabackend/goahttpclient.c
@@ -226,7 +226,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]