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



commit 55f1171b15d5c307894943a6b753dd8e59b1452d
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Dec 5 16:03:01 2012 +0100

    ewsclient: Fix cancellation
    
    Free the AutodiscoverData in an idle handler because soup_session_abort
    invokes ews_client_autodiscover_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/goaewsclient.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/goabackend/goaewsclient.c b/src/goabackend/goaewsclient.c
index 49ef041..847429a 100644
--- a/src/goabackend/goaewsclient.c
+++ b/src/goabackend/goaewsclient.c
@@ -90,9 +90,11 @@ typedef struct
   gchar *username;
 } AutodiscoverAuthData;
 
-static void
-ews_client_autodiscover_data_free (AutodiscoverData *data)
+static gboolean
+ews_client_autodiscover_data_free (gpointer user_data)
 {
+  AutodiscoverData *data = user_data;
+
   if (data->cancellable_id > 0)
     {
       g_cancellable_disconnect (data->cancellable, data->cancellable_id);
@@ -104,6 +106,8 @@ ews_client_autodiscover_data_free (AutodiscoverData *data)
   g_object_unref (data->res);
   g_object_unref (data->session);
   g_slice_free (AutodiscoverData, data);
+
+  return G_SOURCE_REMOVE;
 }
 
 static void
@@ -326,7 +330,7 @@ ews_client_autodiscover_response_cb (SoupSession *session, SoupMessage *msg, gpo
 
   g_simple_async_result_set_op_res_gboolean (data->res, op_res);
   g_simple_async_result_complete_in_idle (data->res);
-  ews_client_autodiscover_data_free (data);
+  g_idle_add (ews_client_autodiscover_data_free, data);
 }
 
 static xmlDoc *


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