[evolution-kolab] Bug #673197 - Calendar backend crashing when opening an entry several times for editing (partial fix



commit 9d0fd8c600eac78019592267b5742555dbbb2d85
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Thu Apr 12 21:27:40 2012 +0200

    Bug #673197 - Calendar backend crashing when opening an entry several times for editing (partial fix)
    
    * partially fixes an issue with libical0.48 timezone handling,
      where upstream timezone handling fixes in libical uncovered
      a more general problem with libical internal memory management
      (see http://sourceforge.net/mailarchive/message.php?msg_id=29069293)
    * we can avoid the crash, but need to revisit the issue
      once upstream has fixed the timezone memory handling
      so we can see whether we need to do anything else to
      complete this fix

 .../main/src/evolution/priv-common-e-to-i.c        |   13 ++++++++-----
 src/libekolabconv/main/src/structs/common.c        |   12 +++++++++++-
 2 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/src/libekolabconv/main/src/evolution/priv-common-e-to-i.c b/src/libekolabconv/main/src/evolution/priv-common-e-to-i.c
index 3b47e21..d9e871f 100644
--- a/src/libekolabconv/main/src/evolution/priv-common-e-to-i.c
+++ b/src/libekolabconv/main/src/evolution/priv-common-e-to-i.c
@@ -47,6 +47,7 @@ static gchar*
 get_vtimezone (const ECalComponentWithTZ *ectz)
 {
 	icalcomponent *icc = NULL;
+	icalcomponent *cloned_icc = NULL;
 	icalproperty *dtstamp = NULL;
 	icalproperty *uid = NULL;
 	gchar *ical_str = NULL;
@@ -55,16 +56,18 @@ get_vtimezone (const ECalComponentWithTZ *ectz)
 		return NULL;
 
 	icc = e_cal_component_get_icalcomponent (ectz->timezone);
+	cloned_icc = icalcomponent_new_clone (icc);
 
 	/* uid and dtstamp are not needed (nor wanted) in timezone block */
-	uid = icalcomponent_get_first_property(icc, ICAL_UID_PROPERTY);
-	icalcomponent_remove_property (icc, uid);
+	uid = icalcomponent_get_first_property(cloned_icc, ICAL_UID_PROPERTY);
+	icalcomponent_remove_property (cloned_icc, uid);
 	free(uid);
-	dtstamp = icalcomponent_get_first_property(icc, ICAL_DTSTAMP_PROPERTY);
-	icalcomponent_remove_property (icc, dtstamp);
+	dtstamp = icalcomponent_get_first_property(cloned_icc, ICAL_DTSTAMP_PROPERTY);
+	icalcomponent_remove_property (cloned_icc, dtstamp);
 	free(dtstamp);
 
-	ical_str = icalcomponent_as_ical_string (icc);
+	ical_str = icalcomponent_as_ical_string (cloned_icc);
+	icalcomponent_free (cloned_icc);
 
 	return ical_str;
 }
diff --git a/src/libekolabconv/main/src/structs/common.c b/src/libekolabconv/main/src/structs/common.c
index a265f5d..9ba280e 100644
--- a/src/libekolabconv/main/src/structs/common.c
+++ b/src/libekolabconv/main/src/structs/common.c
@@ -237,7 +237,17 @@ free_i_common (I_common **i_common)
 		G_STRING_FREE (ic->categories);
 		free_date_or_datetime (&ic->creation_datetime);
 		free_date_or_datetime (&ic->last_modified_datetime);
-		g_free(ic->vtimezone);
+		/* g_free(ic->vtimezone); */
+		/* FIXME timezone leak fixes in libical0.48 make
+		 *       this one to lead to mem corruption when
+		 *       storing an object (did not happen in 0.44).
+		 *
+		 *       We will need to wait for upstream libical
+		 *       fixes for the memory corruption which
+		 *       are being worked on for an updated 0.48,
+		 *       then return here to see whether we can do
+		 *       better than just not freeing the timezone
+		 */
 
 		g_list_free(ic->kolab_attachment_store); /* no need to free content (must be freed outside of the library) */
 		ic->kolab_attachment_store = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]