[evolution/webkit] Bug #635673 - Stack overflow when opening slow calendar



commit c10549388ec01a474b7dd5c2d7e14ca6ff26b456
Author: Milan Crha <mcrha redhat com>
Date:   Wed Nov 24 14:28:53 2010 +0100

    Bug #635673 - Stack overflow when opening slow calendar

 calendar/common/authentication.c |    1 +
 calendar/gui/e-cal-model.c       |   21 +++++++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/calendar/common/authentication.c b/calendar/common/authentication.c
index 0420f1f..286b7d6 100644
--- a/calendar/common/authentication.c
+++ b/calendar/common/authentication.c
@@ -274,6 +274,7 @@ fail:
 	} else if (g_error_matches (
 		error, E_CALENDAR_ERROR, E_CALENDAR_STATUS_BUSY)) {
 		g_clear_error (&error);
+		g_usleep (250000);
 		goto try_again;
 
 	} else {
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 294b54c..f33a6f5 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -2524,6 +2524,19 @@ backend_died_cb (ECal *client, gpointer user_data)
 	e_cal_model_remove_client (model, client);
 }
 
+static gboolean
+wait_open_cb (gpointer data)
+{
+	ECal *client = data;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL (client), FALSE);
+
+	e_cal_open_async (client, FALSE);
+
+	return FALSE;
+}
+
 static void
 cal_opened_cb (ECal *client, const GError *error, gpointer user_data)
 {
@@ -2531,10 +2544,13 @@ cal_opened_cb (ECal *client, const GError *error, gpointer user_data)
 	ECalModelClient *client_data;
 
 	if (g_error_matches (error, E_CALENDAR_ERROR, E_CALENDAR_STATUS_BUSY)) {
-		e_cal_open_async (client, FALSE);
+		g_timeout_add (250, wait_open_cb, client);
 		return;
 	}
 
+	/* Stop listening for this calendar to be opened */
+	g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, NULL, cal_opened_cb, model);
+
 	if (error) {
 		e_cal_model_remove_client (model, client);
 		e_cal_model_update_status_message (model, NULL, -1.0);
@@ -2543,9 +2559,6 @@ cal_opened_cb (ECal *client, const GError *error, gpointer user_data)
 
 	e_cal_model_update_status_message (model, NULL, -1.0);
 
-	/* Stop listening for this calendar to be opened */
-	g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, NULL, cal_opened_cb, model);
-
 	client_data = find_client_data (model, client);
 	g_return_if_fail (client_data);
 



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