[evolution-patches] patch for #60310 (calendar)
- From: Rodrigo Moya <rodrigo novell com>
- To: Evolution Patches <evolution-patches lists ximian com>
- Subject: [evolution-patches] patch for #60310 (calendar)
- Date: Thu, 30 Sep 2004 14:45:06 +0200
This patch was lying around in my source tree. It's for 2.0.2
--
Rodrigo Moya <rodrigo novell com>
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.324.2.5
diff -u -p -r1.324.2.5 ChangeLog
--- ChangeLog 28 Sep 2004 15:57:45 -0000 1.324.2.5
+++ ChangeLog 30 Sep 2004 12:36:30 -0000
@@ -1,3 +1,16 @@
+2004-09-30 Rodrigo Moya <rodrigo novell com>
+
+ Probably fixes #60310
+
+ * backends/file/e-cal-backend-file.c (remove_recurrence_cb,
+ remove_component): use g_hash_table_foreach_remove instead
+ of simple foreach so that we remove the hash items as we
+ free them.
+ (scan_vcalendar, e_cal_backend_file_create_object,
+ e_cal_backend_file_modify_object, e_cal_backend_file_receive_objects):
+ check return value from e_cal_component_set_icalcomponent().
+ (match_object_sexp): only try to match recurrences if there are.
+
2004-09-28 Rodrigo Moya <rodrigo novell com>
Fixes #66230
Index: backends/file/e-cal-backend-file.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/file/e-cal-backend-file.c,v
retrieving revision 1.35
diff -u -p -r1.35 e-cal-backend-file.c
--- backends/file/e-cal-backend-file.c 17 Aug 2004 14:32:39 -0000 1.35
+++ backends/file/e-cal-backend-file.c 30 Sep 2004 12:36:32 -0000
@@ -465,7 +465,7 @@ add_component (ECalBackendFile *cbfile,
}
/* g_hash_table_foreach() callback to remove recurrences from the calendar */
-static void
+static gboolean
remove_recurrence_cb (gpointer key, gpointer value, gpointer data)
{
GList *l;
@@ -491,6 +491,12 @@ remove_recurrence_cb (gpointer key, gpoi
e_cal_component_get_categories_list (comp, &categories);
e_cal_backend_unref_categories (E_CAL_BACKEND (cbfile), categories);
e_cal_component_free_categories_list (categories);
+
+ /* free memory */
+ g_free (key);
+ g_object_unref (comp);
+
+ return TRUE;
}
/* Removes a component from the backend's hash and lists. Does not perform
@@ -530,7 +536,7 @@ remove_component (ECalBackendFile *cbfil
priv->comp = g_list_delete_link (priv->comp, l);
/* remove the recurrences also */
- g_hash_table_foreach (obj_data->recurrences, (GHFunc) remove_recurrence_cb, cbfile);
+ g_hash_table_foreach_remove (obj_data->recurrences, (GHRFunc) remove_recurrence_cb, cbfile);
/* Update the set of categories */
e_cal_component_get_categories_list (comp, &categories);
@@ -568,9 +574,10 @@ scan_vcalendar (ECalBackendFile *cbfile)
continue;
comp = e_cal_component_new ();
-
- if (!e_cal_component_set_icalcomponent (comp, icalcomp))
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
+ g_object_unref (comp);
continue;
+ }
add_component (cbfile, comp, FALSE);
}
@@ -1181,9 +1188,11 @@ match_object_sexp (gpointer key, gpointe
}
/* match also recurrences */
- g_hash_table_foreach (obj_data->recurrences,
- (GHFunc) match_recurrence_sexp,
- match_data);
+ if (g_hash_table_size > 0) {
+ g_hash_table_foreach (obj_data->recurrences,
+ (GHFunc) match_recurrence_sexp,
+ match_data);
+ }
}
/* Get_objects_in_range handler for the file backend */
@@ -1675,7 +1684,10 @@ e_cal_backend_file_create_object (ECalBa
/* Create the cal component */
comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomp);
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
+ g_object_unref (comp);
+ return GNOME_Evolution_Calendar_InvalidObject;
+ }
/* Set the created and last modified times on the component */
current = icaltime_from_timet (time (NULL), 0);
@@ -1740,7 +1752,10 @@ e_cal_backend_file_modify_object (ECalBa
/* Create the cal component */
comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomp);
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
+ g_object_unref (comp);
+ return GNOME_Evolution_Calendar_InvalidObject;
+ }
/* Set the last modified time on the component */
current = icaltime_from_timet (time (NULL), 0);
@@ -2034,7 +2049,7 @@ check_tzids (icalparameter *param, void
tzdata->found = FALSE;
}
-/* Update_objects handler for the file backend. */
+/* Receive_objects handler for the file backend. */
static ECalBackendSyncStatus
e_cal_backend_file_receive_objects (ECalBackendSync *backend, EDataCal *cal, const char *calobj)
{
@@ -2129,7 +2144,10 @@ e_cal_backend_file_receive_objects (ECal
/* Create the cal component */
comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, subcomp);
+ if (!e_cal_component_set_icalcomponent (comp, subcomp)) {
+ g_object_unref (comp);
+ continue;
+ }
/* Set the created and last modified times on the component */
current = icaltime_from_timet (time (NULL), 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]