Re: [evolution-patches] [calendar] fix for #60736



On Tue, 2004-07-20 at 13:43 +0200, Rodrigo Moya wrote:
> I think the problem is being caused by the idle callback being called
> twice, so this probably fixes it.

a better patch that stores the 2 different idle handler ID's in 2
separated variables.

cheers
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.298
diff -u -p -r1.298 ChangeLog
--- ChangeLog	16 Jul 2004 21:10:04 -0000	1.298
+++ ChangeLog	22 Jul 2004 15:08:30 -0000
@@ -1,3 +1,13 @@
+2004-07-20  Rodrigo Moya <rodrigo novell com>
+
+	Probably fixes #60736
+
+	* libecal/e-cal.c (async_auth_idle_cb): remove the idle callback so
+	that it doesn't get called more than once.
+	(async_signal_idle_cb): ditto.
+	(async_auth_func_cb, open_async): store the idle handler id to be
+	able to remove it in the above functions.
+
 2004-07-15  JP Rosevear  <jpr novell com>
 
 	Fixes #58748
Index: libecal/e-cal.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal.c,v
retrieving revision 1.68
diff -u -p -r1.68 e-cal.c
--- libecal/e-cal.c	2 Jun 2004 16:15:00 -0000	1.68
+++ libecal/e-cal.c	22 Jul 2004 15:08:31 -0000
@@ -1586,6 +1586,8 @@ typedef struct {
 	char *password;
 	GMutex *mutex;
 	GCond *cond;
+	guint auth_idle_id;
+	guint signal_idle_id;
 } ECalAsyncData;
 
 static gboolean
@@ -1593,6 +1595,9 @@ async_auth_idle_cb (gpointer data)
 {
 	ECalAsyncData *ccad = data;
 
+	g_source_remove (ccad->auth_idle_id);
+	ccad->auth_idle_id = -1;
+
 	g_mutex_lock (ccad->mutex);
 	ccad->password = ccad->real_auth_func (ccad->ecal, ccad->auth_prompt, ccad->auth_key, ccad->real_auth_user_data);
 	g_cond_signal (ccad->cond);
@@ -1606,6 +1611,9 @@ async_signal_idle_cb (gpointer data)
 {
 	ECalAsyncData *ccad = data;
 
+	g_source_remove (ccad->signal_idle_id);
+	ccad->signal_idle_id = -1;
+
 	g_signal_emit (G_OBJECT (ccad->ecal), e_cal_signals[CAL_OPENED], 0, ccad->status);
 
 	ccad->ecal->priv->auth_func = ccad->real_auth_func;
@@ -1629,8 +1637,8 @@ async_auth_func_cb (ECal *ecal, const ch
 	ccad->auth_prompt = prompt;
 	ccad->auth_key = key;
 
-	g_idle_add ((GSourceFunc) async_auth_idle_cb, ccad);
-		
+	ccad->auth_idle_id = g_idle_add ((GSourceFunc) async_auth_idle_cb, ccad);
+
 	g_mutex_lock (ccad->mutex);
 	g_cond_wait (ccad->cond, ccad->mutex);
 	password = ccad->password;
@@ -1640,7 +1648,6 @@ async_auth_func_cb (ECal *ecal, const ch
 	return password;
 }
 
-
 static gpointer
 open_async (gpointer data) 
 {
@@ -1655,7 +1662,7 @@ open_async (gpointer data) 
 	ccad->ecal->priv->auth_user_data = ccad;
 
 	ccad->result = open_calendar (ccad->ecal, ccad->exists, NULL, &ccad->status);
-	g_idle_add ((GSourceFunc) async_signal_idle_cb, ccad);
+	ccad->signal_idle_id = g_idle_add ((GSourceFunc) async_signal_idle_cb, ccad);
 
 	return GINT_TO_POINTER (ccad->result);
 }


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