Approval required to commit the patch for bug [312462]



Hi, 
   The maintainer has approved the patch. The patch fixes a crash
in Evolution-data-server. The link for the bug is
http://bugzilla.gnome.org/show_bug.cgi?id=312462

Have attached the patch with the mail.

thanks, Chenthill.
--- Begin Message ---
Looks good. Approved. 
Please commit after 2/2 from the release team.

This also partially solves #115051 on bugzilla.novell.com. Update it
upon commit, pl.
Just a suggestion. Kindly reply to the thread henceforth for re-posts on
the patches - so we have the context available.

Thanks,
Harish



On Tue, 2005-08-16 at 23:25 -0600, Chakravarthi P wrote:
> hi,
> 
>     the following patch fixes 
>     http://bugzilla.gnome.org/show_bug.cgi?id=312462
>     The access to the static variable saved_tz needs to 
>      be synchronized to avoid this occasional e-d-s crash.
> 
>     please review.
> 
>   regards.
> 
>     
> _______________________________________________
> evolution-patches mailing list
> evolution-patches lists ximian com
> http://lists.ximian.com/mailman/listinfo/evolution-patches


--- End Message ---
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libical/ChangeLog,v
retrieving revision 1.172
diff -u -p -w -r1.172 ChangeLog
--- ChangeLog	12 Aug 2005 01:15:42 -0000	1.172
+++ ChangeLog	17 Aug 2005 05:18:49 -0000
@@ -1,3 +1,10 @@
+2005-08-16  P. S. Chakravarthi <pchakravarthi novell com>
+
+	Fixes #312462
+	* src/libical/icaltime.c (set_tz), (unset_tz) : make the code
+	accessing saved_tz synchronous by having an accessor and a release
+	function. 
+
 2005-08-12  Tor Lillqvist  <tml novell com>
 
 	* src/libical/Makefile.am (libical_evolution_la_LIBADD): Add
Index: src/libical/icaltime.c
===================================================================
RCS file: /cvs/gnome/libical/src/libical/icaltime.c,v
retrieving revision 1.36
diff -u -p -w -r1.36 icaltime.c
--- src/libical/icaltime.c	15 Mar 2005 01:48:04 -0000	1.36
+++ src/libical/icaltime.c	17 Aug 2005 05:18:50 -0000
@@ -51,6 +51,11 @@
 #define strcasecmp    stricmp
 #endif
 
+#ifdef HAVE_PTHREAD
+ #include <pthread.h>    
+    static pthread_mutex_t tzid_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
 /*
  *  Function to convert a struct tm time specification
  *  to an ANSI time_t using the specified time zone.
@@ -317,13 +322,16 @@ char* set_tz(const char* tzid)
     /* Add the new TZ to the environment. */
     putenv(new_tz); 
 
-    /* Free any previous TZ environment string we have used. */
-    if (saved_tz)
+    /* Free any previous TZ environment string we have used in a synchronized manner. */
+
+    if (access_saved_tz ()) 
       free (saved_tz);
 
     /* Save a pointer to the TZ string we just set, so we can free it later. */
     saved_tz = new_tz;
 
+    release_saved_tz ();
+
     return old_tz_copy; /* This will be zero if the TZ env var was not set */
 }
 
@@ -346,13 +354,16 @@ void unset_tz(char *tzstr)
 #endif
     } 
 
-    /* Free any previous TZ environment string we have used. */
-    if (saved_tz)
+    /* Free any previous TZ environment string we have used in a synchronized manner */
+
+    if (access_saved_tz ()) 
 	free (saved_tz);
 
     /* Save a pointer to the TZ string we just set, so we can free it later.
        (This can possibly be NULL if there was no TZ to restore.) */
     saved_tz = tzstr;
+
+    release_saved_tz ();	
 }
 
 /**	Return the time as seconds past the UNIX epoch, using the
@@ -1151,3 +1162,33 @@ int icaltime_span_contains(icaltime_span
   
   return 0;
 }
+
+/* @brief gives access the static variable saved_tz synchronously  
+ * @return		The pointer to the saved_tz
+ *
+ */
+
+static char * access_saved_tz ()
+{
+ 
+	#ifdef HAVE_PTHREAD
+	    pthread_mutex_lock (&tzid_mutex);
+	#endif
+	return saved_tz;
+
+}
+
+
+/* @brief releases the access to the static variable saved_tz synchronously  
+ *
+ */
+
+static void release_saved_tz ()
+{
+ 
+	#ifdef HAVE_PTHREAD
+	    pthread_mutex_unlock (&tzid_mutex);
+	#endif
+	return;
+
+}


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