Re: [evolution-patches] Patch for async authentication to Evolution Calendar



On Tue, 2004-04-20 at 03:22 -0400, JP Rosevear wrote:
> On Wed, 2004-04-14 at 16:42 +0530, Harish Krishnaswamy wrote:
> > hi,
> > 
> >  The patch is a fix for #55802 and allows async authentication to the
> > Evolution calendar -decoupling authentication to the backend and getting
> > the password in the UI into different threads.
> 
> This patch seems to break the calendar, presumably because the open
> signal is being emitted in the created thread rather than the main
> thread.

I believe the attached patch fixes the issue, but I haven't gone through
all the possible races in my head.

-JP
-- 
JP Rosevear <jpr ximian com>
Novell, Inc.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.244
diff -u -r1.244 ChangeLog
--- ChangeLog	16 Apr 2004 03:30:33 -0000	1.244
+++ ChangeLog	20 Apr 2004 07:32:29 -0000
@@ -1,3 +1,9 @@
+2004-04-20  JP Rosevear  <jpr ximian com>
+
+	* libecal/e-cal.c (open_async): emit the open signal in an idle
+	loop
+	(async_signal_idle_cb): emit the signal and free the data
+
 2004-04-16  Harish Krishnaswamy  <kharish novell com>
 	
 	Fixes #55802
Index: libecal/e-cal.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal.c,v
retrieving revision 1.56
diff -u -r1.56 e-cal.c
--- libecal/e-cal.c	16 Apr 2004 03:28:05 -0000	1.56
+++ libecal/e-cal.c	20 Apr 2004 07:32:29 -0000
@@ -1603,6 +1603,25 @@
 	return FALSE;
 }
 
+static gboolean
+async_signal_idle_cb (gpointer data)
+{
+	ECalAsyncData *ccad = data;
+
+	g_signal_emit (G_OBJECT (ccad->ecal), e_cal_signals[CAL_OPENED], 0, ccad->status);
+
+	ccad->ecal->priv->auth_func = ccad->real_auth_func;
+	ccad->ecal->priv->auth_user_data = ccad->real_auth_user_data;
+	g_mutex_free (ccad->mutex);
+	g_cond_free (ccad->cond);
+
+	/* free memory */
+	g_object_unref (ccad->ecal);
+	g_free (ccad);
+	
+	return FALSE;
+}
+
 static char *
 async_auth_func_cb (ECal *ecal, const char *prompt, const char *key, gpointer user_data)
 {
@@ -1638,17 +1657,7 @@
 	ccad->ecal->priv->auth_user_data = ccad;
 
 	ccad->result = open_calendar (ccad->ecal, ccad->exists, NULL, &ccad->status);
-	g_signal_emit (G_OBJECT (ccad->ecal), e_cal_signals[CAL_OPENED], 0, ccad->status);
-
-	ccad->ecal->priv->auth_func = ccad->real_auth_func;
-	ccad->ecal->priv->auth_user_data = ccad->real_auth_user_data;
-	g_mutex_free (ccad->mutex);
-	g_cond_free (ccad->cond);
-
-	/* free memory */
-	g_object_unref (ccad->ecal);
-	g_free (ccad);
-
+	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]