[evolution-ews] Autodiscover can cause deadlock in GCancellable code
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Autodiscover can cause deadlock in GCancellable code
- Date: Wed, 30 Nov 2016 18:36:17 +0000 (UTC)
commit 9b73c564aa78a34bc5b279771ab2221f23e2c123
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 c4f2f4c..40a9fbe 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -2452,7 +2452,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) {
@@ -2460,6 +2459,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]