[evolution-ews] Fix possible crash at the end of autodiscovery



commit cc434be6e27f22b602e45b756c3b6fb707668fa4
Author: Milan Crha <mcrha redhat com>
Date:   Tue Apr 17 09:52:01 2012 +0200

    Fix possible crash at the end of autodiscovery

 src/server/e-ews-connection.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index ff324c0..c520bb4 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -1442,7 +1442,10 @@ autodiscover_response_cb (SoupSession *session,
 
 	g_simple_async_result_set_op_res_gpointer (ad->simple, urls, NULL);
 	g_simple_async_result_complete_in_idle (ad->simple);
-	g_object_unref (simple);
+	/* the 'simple' holds reference on 'cnc' and this function
+	   is called in a dedicated thread, which 'cnc' joins on dispose,
+	   thus to avoid race condition, unref the object in its own thread */
+	ews_unref_in_thread (G_OBJECT (simple));
 	return;
 
 failed:
@@ -1461,7 +1464,10 @@ failed:
 	 * want the *first* error */
 	g_simple_async_result_set_from_error (ad->simple, error);
 	g_simple_async_result_complete_in_idle (ad->simple);
-	g_object_unref (simple);
+	/* the 'simple' holds reference on 'cnc' and this function
+	   is called in a dedicated thread, which 'cnc' joins on dispose,
+	   thus to avoid race condition, unref the object in its own thread */
+	ews_unref_in_thread (G_OBJECT (simple));
 }
 
 static void post_restarted (SoupMessage *msg, gpointer data)



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