[evolution-kolab: 2/3] ECalBackendKolab: do not return unmodified object on create()
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab: 2/3] ECalBackendKolab: do not return unmodified object on create()
- Date: Mon, 16 Apr 2012 12:44:49 +0000 (UTC)
commit 797561d545e33de04cb44e548bf4ad74718a5d2e
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Mon Apr 16 10:37:00 2012 +0200
ECalBackendKolab: do not return unmodified object on create()
* we do not currently read-back a newly created object
from the server directly after writing it
* so no point returning the same object Evolution already
has
* there is, however, a possible race condition, so to be
on the safest side, we would need to read-back the
object right away and return the result to Evo
(TODO)
src/calendar/e-cal-backend-kolab.c | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-kolab.c b/src/calendar/e-cal-backend-kolab.c
index 98de5d9..3f31abe 100644
--- a/src/calendar/e-cal-backend-kolab.c
+++ b/src/calendar/e-cal-backend-kolab.c
@@ -945,7 +945,6 @@ e_cal_backend_kolab_create_object (ECalBackendSync *backend,
}
}
-
ok = kolab_util_calendar_cache_assure_uid_on_ecalcomponent (priv->cal_cache,
priv->cal_koma,
ecalcomp,
@@ -962,6 +961,9 @@ e_cal_backend_kolab_create_object (ECalBackendSync *backend,
return;
}
+ e_cal_component_get_uid (ecalcomp, &tmp_uid);
+ *uid = g_strdup (tmp_uid);
+
ok = kolab_util_calendar_store (ecalcomp,
tzcomp,
priv->default_zone,
@@ -978,12 +980,23 @@ e_cal_backend_kolab_create_object (ECalBackendSync *backend,
return;
}
- e_cal_component_get_uid (ecalcomp, &tmp_uid);
- *uid = g_strdup (tmp_uid);
- *new_component = ecalcomp;
-
+ g_object_unref (ecalcomp);
if (tzcomp != NULL)
g_object_unref (tzcomp);
+
+ /* TODO Check whether we had a collision on the server
+ * while storing the object (corner case, there
+ * would need to be a race condition between clients,
+ * which want to write objects with identical UID,
+ * between the calls to
+ * kolab_util_calendar_cache_assure_uid_on_ecalcomponent()
+ * and kolab_util_calendar_store() in this function
+ *
+ * In that case we would need to read-back the object
+ * from the server (can UID have changed...?) and return
+ * a copy in *new_component (and set *uid) before returning
+ * from this function
+ */
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]