[evolution-data-server] calendar file backend: fixed incomplete sanity check in e_cal_create_object()
- From: Patrick Ohly <pohly src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] calendar file backend: fixed incomplete sanity check in e_cal_create_object()
- Date: Wed, 10 Aug 2011 16:08:34 +0000 (UTC)
commit 0c178bbab1008a8574d58c2019c22f892010d9a0
Author: Patrick Ohly <patrick ohly intel com>
Date: Tue Aug 9 11:26:16 2011 +0300
calendar file backend: fixed incomplete sanity check in e_cal_create_object()
e_cal_create_object() traditionally is used for a new events which are
unrelated to anything in the calendar. Adding detached recurrences
to an existing meeting series has to be done with e_cal_modify_object().
The code did not correctly reject the addition of a parent event for a
previously added child event event because lookup_component() returned
NULL in that case.
This commit renames lookup_component() and redefines the return value
to match what it is used for: checking for the existance of a UID.
calendar/backends/file/e-cal-backend-file.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c
index 46b3b30..46c2e35 100644
--- a/calendar/backends/file/e-cal-backend-file.c
+++ b/calendar/backends/file/e-cal-backend-file.c
@@ -374,9 +374,11 @@ e_cal_backend_file_finalize (GObject *object)
-/* Looks up a component by its UID on the backend's component hash table */
-static ECalComponent *
-lookup_component (ECalBackendFile *cbfile, const gchar *uid)
+/* Looks up an component by its UID on the backend's component hash table
+ and returns TRUE if any event (regardless whether it is the master or a child)
+ with that UID exists */
+static gboolean
+uid_in_use (ECalBackendFile *cbfile, const gchar *uid)
{
ECalBackendFilePrivate *priv;
ECalBackendFileObject *obj_data;
@@ -384,7 +386,7 @@ lookup_component (ECalBackendFile *cbfile, const gchar *uid)
priv = cbfile->priv;
obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
- return obj_data ? obj_data->full_object : NULL;
+ return obj_data != NULL;
}
@@ -2109,7 +2111,7 @@ e_cal_backend_file_create_object (ECalBackendSync *backend, EDataCal *cal, GCanc
}
/* check the object is not in our cache */
- if (lookup_component (cbfile, comp_uid)) {
+ if (uid_in_use (cbfile, comp_uid)) {
icalcomponent_free (icalcomp);
g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
g_propagate_error (error, EDC_ERROR (ObjectIdAlreadyExists));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]