[evolution-mapi] Unref connection in a dedicated thread on EBackend::online change
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-mapi] Unref connection in a dedicated thread on EBackend::online change
- Date: Mon, 25 Feb 2013 10:06:05 +0000 (UTC)
commit 413455fa95afee7a85dc95b7235429126be261d7
Author: Milan Crha <mcrha redhat com>
Date: Mon Feb 25 11:01:59 2013 +0100
Unref connection in a dedicated thread on EBackend::online change
When network connection changes, the backend can be moved to offline state,
but the EMapiConnection (and libmapi below it) still tries to disconnect from
the server gracefully, which can mean to wait for a connection timeout.
Rather than block whole backend, and the main thread of the factory, in this
waiting, do the unref in a dedicated thread, where it can wait as long as necessary.
src/addressbook/e-book-backend-mapi.c | 4 +---
src/calendar/e-cal-backend-mapi.c | 3 +--
2 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-mapi.c b/src/addressbook/e-book-backend-mapi.c
index 4f0e836..276a110 100644
--- a/src/addressbook/e-book-backend-mapi.c
+++ b/src/addressbook/e-book-backend-mapi.c
@@ -628,7 +628,7 @@ ebbm_notify_online_cb (EBookBackend *backend, GParamSpec *pspec)
ebbm_notify_connection_status (ebma, FALSE);
if (priv->conn) {
- g_object_unref (priv->conn);
+ e_mapi_utils_unref_in_thread (G_OBJECT (priv->conn));
priv->conn = NULL;
}
} else {
@@ -637,8 +637,6 @@ ebbm_notify_online_cb (EBookBackend *backend, GParamSpec *pspec)
e_book_backend_mapi_unlock_connection (ebma);
}
-
- e_backend_set_online (E_BACKEND (backend), online);
}
static void
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index 8950d4b..2702eda 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -2547,12 +2547,11 @@ ecbm_notify_online_cb (ECalBackend *backend, GParamSpec *pspec)
} else {
priv->read_only = TRUE;
- g_object_unref (priv->conn);
+ e_mapi_utils_unref_in_thread (G_OBJECT (priv->conn));
priv->conn = NULL;
}
e_cal_backend_set_writable (backend, !priv->read_only);
- e_backend_set_online (E_BACKEND (backend), online);
g_mutex_unlock (&priv->mutex);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]