[evolution-data-server] ECalBackend: Emit "timezone-added" from outside the cache lock.



commit 8753dad26201fbffa17511d96cd234fd517182de
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jan 11 07:17:19 2013 -0500

    ECalBackend: Emit "timezone-added" from outside the cache lock.
    
    The "timezone-added" signal triggers e_timezone_cache_list_timezones()
    in ECalBackendStore, which also tries to acquire the cache lock.
    
    Similarly in ECalClient, though less chance of deadlock there.

 calendar/libecal/e-cal-client.c       |   14 +++++++++-----
 calendar/libedata-cal/e-cal-backend.c |   14 +++++++++-----
 2 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/calendar/libecal/e-cal-client.c b/calendar/libecal/e-cal-client.c
index d50fb59..c78ceb2 100644
--- a/calendar/libecal/e-cal-client.c
+++ b/calendar/libecal/e-cal-client.c
@@ -908,6 +908,7 @@ cal_client_add_cached_timezone (ETimezoneCache *cache,
 {
 	ECalClientPrivate *priv;
 	const gchar *tzid;
+	gboolean timezone_added = FALSE;
 
 	priv = E_CAL_CLIENT_GET_PRIVATE (cache);
 
@@ -931,14 +932,17 @@ cal_client_add_cached_timezone (ETimezoneCache *cache,
 			priv->zone_cache,
 			g_strdup (tzid), cached_zone);
 
-		/* FIXME Should emit this from an idle GSource on
-		 *       a stored GMainContext, but we don't have
-		 *       a stored GMainContext.  Check back after
-		 *       the D-Bus API rewrite. */
-		g_signal_emit_by_name (cache, "timezone-added", zone);
+		timezone_added = TRUE;
 	}
 
 	g_mutex_unlock (&priv->zone_cache_lock);
+
+	/* FIXME Should emit this from an idle GSource on
+	 *       a stored GMainContext, but we don't have
+	 *       a stored GMainContext.  Check back after
+	 *       the D-Bus API rewrite. */
+	if (timezone_added)
+		g_signal_emit_by_name (cache, "timezone-added", zone);
 }
 
 static icaltimezone *
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index a1a6dbf..2b69367 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -321,6 +321,7 @@ cal_backend_add_cached_timezone (ETimezoneCache *cache,
 {
 	ECalBackendPrivate *priv;
 	const gchar *tzid;
+	gboolean timezone_added = FALSE;
 
 	priv = E_CAL_BACKEND_GET_PRIVATE (cache);
 
@@ -344,14 +345,17 @@ cal_backend_add_cached_timezone (ETimezoneCache *cache,
 			priv->zone_cache,
 			g_strdup (tzid), cached_zone);
 
-		/* FIXME Should emit this from an idle GSource on
-		 *       a stored GMainContext, but we don't have
-		 *       a stored GMainContext.  Check back after
-		 *       the D-Bus API rewrite. */
-		g_signal_emit_by_name (cache, "timezone-added", zone);
+		timezone_added = TRUE;
 	}
 
 	g_mutex_unlock (&priv->zone_cache_lock);
+
+	/* FIXME Should emit this from an idle GSource on
+	 *       a stored GMainContext, but we don't have
+	 *       a stored GMainContext.  Check back after
+	 *       the D-Bus API rewrite. */
+	if (timezone_added)
+		g_signal_emit_by_name (cache, "timezone-added", zone);
 }
 
 static icaltimezone *



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