[evolution-mapi] Bug #569631 - Evolution hangs during the initial fetch of calendar items
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-mapi] Bug #569631 - Evolution hangs during the initial fetch of calendar items
- Date: Tue, 11 May 2010 16:14:12 +0000 (UTC)
commit 2302d936e619eb11b44479820752231983c25b37
Author: Milan Crha <mcrha redhat com>
Date: Tue May 11 18:13:43 2010 +0200
Bug #569631 - Evolution hangs during the initial fetch of calendar items
src/addressbook/e-book-backend-mapi-gal.c | 5 +++++
src/addressbook/e-book-backend-mapi.c | 5 +++++
src/calendar/e-cal-backend-mapi.c | 22 ++++++++++++++++++++--
3 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-mapi-gal.c b/src/addressbook/e-book-backend-mapi-gal.c
index e6c2b88..d7da689 100644
--- a/src/addressbook/e-book-backend-mapi-gal.c
+++ b/src/addressbook/e-book-backend-mapi-gal.c
@@ -384,8 +384,13 @@ e_book_backend_mapi_gal_load_source (EBookBackend *backend,
const gchar *offline, *tmp;
gchar **tokens;
gchar *uri = NULL;
+
if (enable_debug)
printf("MAPI load source\n");
+
+ if (e_book_backend_is_loaded (backend))
+ return GNOME_Evolution_Addressbook_Success;
+
offline = e_source_get_property (source, "offline_sync");
if (offline && g_str_equal (offline, "1"))
priv->marked_for_offline = TRUE;
diff --git a/src/addressbook/e-book-backend-mapi.c b/src/addressbook/e-book-backend-mapi.c
index 9ce10a6..a30fcaf 100644
--- a/src/addressbook/e-book-backend-mapi.c
+++ b/src/addressbook/e-book-backend-mapi.c
@@ -253,8 +253,13 @@ e_book_backend_mapi_load_source (EBookBackend *backend,
const gchar *offline, *tmp;
gchar **tokens;
gchar *uri = NULL;
+
if (enable_debug)
printf("MAPI load source\n");
+
+ if (e_book_backend_is_loaded (backend))
+ return GNOME_Evolution_Addressbook_Success;
+
offline = e_source_get_property (source, "offline_sync");
if (offline && g_str_equal (offline, "1"))
priv->marked_for_offline = TRUE;
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index 8efc47e..fe62667 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -80,6 +80,7 @@ struct _ECalBackendMAPIPrivate {
CalMode mode;
gboolean mode_changed;
icaltimezone *default_zone;
+ gboolean populating_cache; /* whether in populate_cache */
/* timeout handler for syncing sendoptions */
guint sendoptions_sync_timeout;
@@ -1136,10 +1137,17 @@ populate_cache (ECalBackendMAPI *cbmapi)
gchar t_str [26];
priv = cbmapi->priv;
- source = e_cal_backend_get_source (E_CAL_BACKEND (cbmapi));
- kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbmapi));
g_mutex_lock (priv->mutex);
+ if (priv->populating_cache) {
+ g_mutex_unlock (priv->mutex);
+ return GNOME_Evolution_Calendar_Success;
+ }
+ priv->populating_cache = TRUE;
+ g_mutex_unlock (priv->mutex);
+
+ source = e_cal_backend_get_source (E_CAL_BACKEND (cbmapi));
+ kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbmapi));
itt_current = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
current_time = icaltime_as_timet_with_zone (itt_current, icaltimezone_get_utc_timezone ());
@@ -1157,6 +1165,8 @@ populate_cache (ECalBackendMAPI *cbmapi)
MAPI_OPTIONS_FETCH_ALL)) {
e_cal_backend_notify_error (E_CAL_BACKEND (cbmapi), _("Could not create cache file"));
e_file_cache_thaw_changes (E_FILE_CACHE (priv->cache));
+ g_mutex_lock (priv->mutex);
+ priv->populating_cache = FALSE;
g_mutex_unlock (priv->mutex);
return GNOME_Evolution_Calendar_OtherError;
}
@@ -1166,6 +1176,8 @@ populate_cache (ECalBackendMAPI *cbmapi)
MAPI_OPTIONS_FETCH_ALL)) {
e_cal_backend_notify_error (E_CAL_BACKEND (cbmapi), _("Could not create cache file"));
e_file_cache_thaw_changes (E_FILE_CACHE (priv->cache));
+ g_mutex_lock (priv->mutex);
+ priv->populating_cache = FALSE;
g_mutex_unlock (priv->mutex);
return GNOME_Evolution_Calendar_OtherError;
}
@@ -1179,6 +1191,8 @@ populate_cache (ECalBackendMAPI *cbmapi)
e_cal_backend_cache_set_marker (priv->cache);
+ g_mutex_lock (priv->mutex);
+ priv->populating_cache = FALSE;
g_mutex_unlock (priv->mutex);
return GNOME_Evolution_Calendar_Success;
@@ -1301,6 +1315,9 @@ e_cal_backend_mapi_open (ECalBackendSync *backend, EDataCal *cal, gboolean only_
gint i;
uint32_t olFolder = 0;
+ if (e_cal_backend_is_loaded (E_CAL_BACKEND (backend)))
+ return GNOME_Evolution_Calendar_Success;
+
cbmapi = E_CAL_BACKEND_MAPI (backend);
priv = cbmapi->priv;
@@ -2559,6 +2576,7 @@ e_cal_backend_mapi_init (ECalBackendMAPI *cbmapi)
/* create the mutex for thread safety */
priv->mutex = g_mutex_new ();
+ priv->populating_cache = FALSE;
cbmapi->priv = priv;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]