[evolution-ews/gnome-3-22] Autodiscover can cause deadlock in GCancellable code



commit 28ddc27623621e7bdfa28adb707f3d002cb4b731
Author: Milan Crha <mcrha redhat com>
Date:   Wed Nov 30 19:28:50 2016 +0100

    Autodiscover can cause deadlock in GCancellable code
    
    Reported downstream as:
    https://bugzilla.redhat.com/show_bug.cgi?id=1398531

 src/server/e-ews-connection.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index f44d672..898b0f0 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -2454,7 +2454,6 @@ struct _autodiscover_data {
 static void
 autodiscover_data_free (struct _autodiscover_data *ad)
 {
-       g_object_unref (ad->cnc);
        xmlOutputBufferClose (ad->buf);
 
        if (ad->cancellable != NULL) {
@@ -2462,6 +2461,14 @@ autodiscover_data_free (struct _autodiscover_data *ad)
                g_object_unref (ad->cancellable);
        }
 
+       /* Unref the connection after the cancellable is disconnected,
+          to avoid race condition when the connection is freed inside
+          the g_cancellable_disconnect() function, which holds the
+          cancellable lock and blocks all other threads, while at
+          the same time the connection can wait for the finish of
+          its worker thread. */
+       g_object_unref (ad->cnc);
+
        g_free (ad->as_url);
        g_free (ad->oab_url);
 


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