[gnome-online-accounts/gnome-3-6] httpclient: Fix cancellation



commit 012dbc6d6cac1ad1696dd11b96ee389f0efbb134
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Dec 4 17:46:17 2012 +0100

    httpclient: Fix cancellation
    
    Free the CheckData in an idle handler because soup_session_abort
    invokes http_client_check_response_cb. Trying to disconnect the
    GCancellable from a 'cancelled' signal handler will result in a
    deadlock.
    
    Fixes: https://bugzilla.gnome.org/689642

 src/goabackend/goahttpclient.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/goabackend/goahttpclient.c b/src/goabackend/goahttpclient.c
index 9accecc..5290418 100644
--- a/src/goabackend/goahttpclient.c
+++ b/src/goabackend/goahttpclient.c
@@ -82,9 +82,11 @@ typedef struct
   gchar *username;
 } CheckAuthData;
 
-static void
-http_client_check_data_free (CheckData *data)
+static gboolean
+http_client_check_data_free (gpointer user_data)
 {
+  CheckData *data = user_data;
+
   if (data->cancellable_id > 0)
     {
       g_cancellable_disconnect (data->cancellable, data->cancellable_id);
@@ -95,6 +97,8 @@ http_client_check_data_free (CheckData *data)
   g_object_unref (data->res);
   g_object_unref (data->session);
   g_slice_free (CheckData, data);
+
+  return G_SOURCE_REMOVE;
 }
 
 static void
@@ -171,7 +175,7 @@ http_client_check_response_cb (SoupSession *session, SoupMessage *msg, gpointer
     g_simple_async_result_take_error (data->res, error);
 
   g_simple_async_result_complete_in_idle (data->res);
-  http_client_check_data_free (data);
+  g_idle_add (http_client_check_data_free, data);
 }
 
 void


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