[evolution-ews/gnome-3-4] Fix possible crash at the end of autodiscovery



commit 9cd6f20a420c4745073f06e503589f14455057c7
Author: Milan Crha <mcrha redhat com>
Date:   Tue Apr 17 09:52:27 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 f23adac..6526b68 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -1435,7 +1435,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:
@@ -1454,7 +1457,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]