[evolution-data-server] Bug #657181 - Backends can be left half-opened when using ECal
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug #657181 - Backends can be left half-opened when using ECal
- Date: Wed, 24 Aug 2011 15:04:11 +0000 (UTC)
commit 16f2087d802332ef915f028b51df8179d2ef6b4b
Author: Milan Crha <mcrha redhat com>
Date: Wed Aug 24 17:02:05 2011 +0200
Bug #657181 - Backends can be left half-opened when using ECal
addressbook/libedata-book/e-book-backend.c | 4 +++-
calendar/libecal/e-cal.c | 19 +++++++++++++++++++
calendar/libedata-cal/e-cal-backend.c | 4 +++-
3 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c
index 749b139..5913751 100644
--- a/addressbook/libedata-book/e-book-backend.c
+++ b/addressbook/libedata-book/e-book-backend.c
@@ -816,8 +816,10 @@ e_book_backend_remove_client (EBookBackend *backend,
/* When all clients go away, notify the parent factory about it so that
* it may decide whether to kill the backend or not.
*/
- if (!backend->priv->clients)
+ if (!backend->priv->clients) {
+ backend->priv->opening = FALSE;
last_client_gone (backend);
+ }
g_mutex_unlock (backend->priv->clients_mutex);
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index 3780779..80be45f 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -814,6 +814,20 @@ authenticate_user_ready_cb (GObject *source_object, GAsyncResult *result, gpoint
g_error_free (error);
}
+static void
+finish_backend_opening_phase (ECal *cal)
+{
+ const gchar *strv[2];
+
+ g_return_if_fail (cal != NULL);
+ g_return_if_fail (E_IS_CAL (cal));
+
+ strv[0] = "";
+ strv[1] = NULL;
+
+ e_gdbus_cal_call_authenticate_user_sync (cal->priv->gdbus_cal, (const gchar * const *) strv, NULL, NULL);
+}
+
static gboolean
call_authenticate_user (ECal *cal, gboolean async, GError **error)
{
@@ -839,12 +853,14 @@ call_authenticate_user (ECal *cal, gboolean async, GError **error)
if (priv->auth_func == NULL) {
priv->load_state = E_CAL_LOAD_NOT_LOADED;
+ finish_backend_opening_phase (cal);
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
}
username = e_source_get_duped_property (priv->source, "username");
if (!username) {
priv->load_state = E_CAL_LOAD_NOT_LOADED;
+ finish_backend_opening_phase (cal);
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
}
@@ -872,6 +888,7 @@ call_authenticate_user (ECal *cal, gboolean async, GError **error)
if (!key) {
priv->load_state = E_CAL_LOAD_NOT_LOADED;
g_free (username);
+ finish_backend_opening_phase (cal);
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
}
@@ -880,6 +897,7 @@ call_authenticate_user (ECal *cal, gboolean async, GError **error)
if (!password) {
priv->load_state = E_CAL_LOAD_NOT_LOADED;
g_free (username);
+ finish_backend_opening_phase (cal);
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
}
@@ -916,6 +934,7 @@ call_authenticate_user (ECal *cal, gboolean async, GError **error)
unwrap_gerror (error);
} else if (priv->requires_auth) {
priv->load_state = E_CAL_LOAD_NOT_LOADED;
+ finish_backend_opening_phase (cal);
g_set_error_literal (error, E_CALENDAR_ERROR, E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, e_cal_get_error_message (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED));
}
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index d79e4e2..c8564da 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -717,8 +717,10 @@ e_cal_backend_remove_client_private (ECalBackend *backend, EDataCal *cal, gboole
/* When all clients go away, notify the parent factory about it so that
* it may decide whether to kill the backend or not.
*/
- if (!priv->clients)
+ if (!priv->clients) {
+ priv->opening = FALSE;
g_signal_emit (backend, signals[LAST_CLIENT_GONE], 0);
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]