[evolution-mapi] Bug #704618 - Missing detached instances in get_object() response
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-mapi] Bug #704618 - Missing detached instances in get_object() response
- Date: Mon, 22 Jul 2013 16:08:18 +0000 (UTC)
commit eac587777d654a66aacf26e6d418a74ef3488a1f
Author: Milan Crha <mcrha redhat com>
Date: Mon Jul 22 18:08:00 2013 +0200
Bug #704618 - Missing detached instances in get_object() response
src/calendar/e-cal-backend-mapi.c | 54 +++++++++++++++++++++++-------------
1 files changed, 34 insertions(+), 20 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index c94e452..70a4d20 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -898,43 +898,57 @@ ecbm_get_object (ECalBackend *backend, EDataCal *cal, GCancellable *cancellable,
{
ECalBackendMAPI *cbmapi;
ECalBackendMAPIPrivate *priv;
- ECalComponent *comp;
cbmapi = (ECalBackendMAPI *)(backend);
e_mapi_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_MAPI (cbmapi), InvalidArg);
+ e_mapi_return_data_cal_error_if_fail (object != NULL, InvalidArg);
priv = cbmapi->priv;
g_mutex_lock (&priv->mutex);
- /* search the object in the cache */
- comp = e_cal_backend_store_get_component (priv->store, uid, rid);
+ if (rid && *rid) {
+ ECalComponent *comp;
- if (!comp) {
- /* the object is not in the backend store, double check that it's
- * also not on the server to prevent for a race condition where we
- * might otherwise mistakenly generate a new UID */
- g_mutex_unlock (&priv->mutex);
- update_local_cache (cbmapi, cancellable);
- g_mutex_lock (&priv->mutex);
+ /* search the object in the cache */
comp = e_cal_backend_store_get_component (priv->store, uid, rid);
- }
- if (comp) {
- g_mutex_unlock (&priv->mutex);
- if (e_cal_backend_get_kind (E_CAL_BACKEND (backend)) ==
- icalcomponent_isa (e_cal_component_get_icalcomponent (comp)))
- *object = e_cal_component_get_as_string (comp);
- else
- *object = NULL;
+ if (!comp) {
+ /* the object is not in the backend store, double check that it's
+ * also not on the server to prevent for a race condition where we
+ * might otherwise mistakenly generate a new UID */
+ g_mutex_unlock (&priv->mutex);
+ update_local_cache (cbmapi, cancellable);
+ g_mutex_lock (&priv->mutex);
+ comp = e_cal_backend_store_get_component (priv->store, uid, rid);
+ }
- g_object_unref (comp);
+ if (comp) {
+ g_mutex_unlock (&priv->mutex);
+
+ *object = e_cal_component_get_as_string (comp);
+ g_object_unref (comp);
+ } else {
+ g_mutex_unlock (&priv->mutex);
+ }
} else {
+ *object = e_cal_backend_store_get_components_by_uid_as_ical_string (priv->store, uid);
+ if (!*object && e_backend_get_online (E_BACKEND (backend))) {
+ /* the object is not in the backend store, double check that it's
+ * also not on the server to prevent for a race condition where we
+ * might otherwise mistakenly generate a new UID */
+ g_mutex_unlock (&priv->mutex);
+ update_local_cache (cbmapi, cancellable);
+ g_mutex_lock (&priv->mutex);
+
+ *object = e_cal_backend_store_get_components_by_uid_as_ical_string (priv->store, uid);
+ }
+
g_mutex_unlock (&priv->mutex);
}
- if (!object || !*object)
+ if (!*object)
g_propagate_error (error, EDC_ERROR (ObjectNotFound));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]