[evolution-ews/gnome-3-4] Avoid unref of EEwsConnection in ews_connection_scheduled_cb()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews/gnome-3-4] Avoid unref of EEwsConnection in ews_connection_scheduled_cb()
- Date: Wed, 18 Jul 2012 13:55:46 +0000 (UTC)
commit 5cddb786867bab27b2ee23c8e796bad55d236670
Author: Milan Crha <mcrha redhat com>
Date: Wed Jul 18 15:55:29 2012 +0200
Avoid unref of EEwsConnection in ews_connection_scheduled_cb()
If that's the last reference, then the e_ews_connection_dispose() will try
to wait for the soup_thread, but this is run in soup_thread, thus it cannot
be done and application is aborted on checking for deadlock.
src/server/e-ews-connection.c | 38 ++++++++++++++++++--------------------
1 files changed, 18 insertions(+), 20 deletions(-)
---
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index a6d3cbf..61235fc 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -136,6 +136,22 @@ ews_connection_error_quark (void)
return quark;
}
+static gpointer
+ews_unref_in_thread_func (gpointer data)
+{
+ g_object_unref (G_OBJECT (data));
+
+ return NULL;
+}
+
+static void
+ews_unref_in_thread (gpointer object)
+{
+ g_return_if_fail (G_IS_OBJECT (object));
+
+ g_thread_create (ews_unref_in_thread_func, object, FALSE, NULL);
+}
+
static void
async_data_free (EwsAsyncData *async_data)
{
@@ -292,7 +308,8 @@ ews_connection_scheduled_cb (gpointer user_data)
}
g_object_unref (sd->message);
- g_object_unref (sd->cnc);
+ /* in case this is the last reference */
+ ews_unref_in_thread (sd->cnc);
g_free (sd);
return FALSE;
@@ -395,25 +412,6 @@ ews_trigger_next_request (EEwsConnection *cnc)
g_source_attach (source, cnc->priv->soup_context);
}
-static gpointer
-ews_unref_in_thread_func (gpointer data)
-{
- g_return_val_if_fail (data != NULL, NULL);
-
- g_object_unref (data);
-
- return NULL;
-}
-
-static void
-ews_unref_in_thread (GObject *object)
-{
- g_return_if_fail (object != NULL);
- g_return_if_fail (G_IS_OBJECT (object));
-
- g_thread_create (ews_unref_in_thread_func, object, FALSE, NULL);
-}
-
/**
* ews_active_job_done
* @cnc:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]