Re: [evolution-patches] Fix for the bug #274409 [calendar]



Resending the patch. Running the get_deltas in seperate thread instead
of the main loop would be the right fix. Have attached the patch.

thanks, chenthill. 

On Tue, 2005-04-12 at 18:19 +0530, chenthill wrote:
> Hi,
>    Have attached the fix for the bug.
> 
> thanks, chenthill.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.432.2.11
diff -u -p -r1.432.2.11 ChangeLog
--- ChangeLog	8 Apr 2005 16:16:04 -0000	1.432.2.11
+++ ChangeLog	13 Apr 2005 09:15:00 -0000
@@ -1,3 +1,11 @@
+2005-04-13  Chenthill Palanisamy  <pchenthill novell com>
+
+	Fixes #274409
+	* backends/groupwise/e-cal-backend-groupwise.c:
+	(get_deltas_timeout), (cache_init), (connect_to_server):
+	Run the get_deltas in a seperate thread instead of the main
+	loop.
+
 2005-04-08  Rodrigo Moya <rodrigo novell com>
 
 	* libecal/e-cal-util.h: added new function's prototype.
Index: backends/groupwise/e-cal-backend-groupwise.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise.c,v
retrieving revision 1.136.2.4
diff -u -p -r1.136.2.4 e-cal-backend-groupwise.c
--- backends/groupwise/e-cal-backend-groupwise.c	6 Apr 2005 15:12:09 -0000	1.136.2.4
+++ backends/groupwise/e-cal-backend-groupwise.c	13 Apr 2005 09:15:00 -0000
@@ -382,6 +382,27 @@ get_deltas (gpointer handle)
         return TRUE;        
 }
 
+static gboolean
+get_deltas_timeout (gpointer cbgw)
+{
+	GThread *thread;
+	GError *error = NULL;
+
+	if (!cbgw)
+		return FALSE;
+
+	thread = g_thread_create ((GThreadFunc) get_deltas, cbgw, FALSE, &error);
+	if (!thread) {
+		g_warning (G_STRLOC ": %s", error->message);
+		g_error_free (error);
+		
+		return GNOME_Evolution_Calendar_OtherError;
+	}
+
+	return TRUE;
+}
+
+
 static char* 
 form_uri (ESource *source)
 {
@@ -468,7 +489,7 @@ cache_init (ECalBackendGroupwise *cbgw)
 
 			/*  Set up deltas only if it is a Calendar backend */
 			if (kind == ICAL_VEVENT_COMPONENT)
-				priv->timeout_id = g_timeout_add (time_interval, (GSourceFunc) get_deltas, (gpointer) cbgw);
+				priv->timeout_id = g_timeout_add (time_interval, (GSourceFunc) get_deltas_timeout, (gpointer) cbgw);
 			priv->mode = CAL_MODE_REMOTE;
 			return GNOME_Evolution_Calendar_Success;
 		}
@@ -495,7 +516,7 @@ cache_init (ECalBackendGroupwise *cbgw)
 		/* get the deltas from the cache */
 		if (get_deltas (cbgw)) {
 			if (kind == ICAL_VEVENT_COMPONENT)
-				priv->timeout_id = g_timeout_add (time_interval, (GSourceFunc) get_deltas, (gpointer) cbgw);
+				priv->timeout_id = g_timeout_add (time_interval, (GSourceFunc) get_deltas_timeout, (gpointer) cbgw);
 			priv->mode = CAL_MODE_REMOTE;
 			return GNOME_Evolution_Calendar_Success;
 		} else {
@@ -559,7 +580,7 @@ connect_to_server (ECalBackendGroupwise 
 
 					return GNOME_Evolution_Calendar_OtherError;
 				}
-				priv->timeout_id = g_timeout_add (CACHE_REFRESH_INTERVAL, (GSourceFunc) get_deltas, (gpointer) cbgw);
+				priv->timeout_id = g_timeout_add (CACHE_REFRESH_INTERVAL, (GSourceFunc) get_deltas_timeout, (gpointer)cbgw);
 
 			}
 	


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