diff --git a/calendar/libedata-cal/e-data-cal-factory.c b/calendar/libedata-cal/e-data-cal-factory.c
index ae0af21..ac8da18 100644
--- a/calendar/libedata-cal/e-data-cal-factory.c
+++ b/calendar/libedata-cal/e-data-cal-factory.c
@@ -103,6 +103,7 @@ backend_last_client_gone_cb (ECalBackend *backend, gpointer data)
 	ECalBackend *ret_backend;
 	const char *uristr;
 	char *uri;
+	gboolean last_calendar;
 
 	factory = E_DATA_CAL_FACTORY (data);
 	priv = factory->priv;
@@ -125,11 +126,13 @@ backend_last_client_gone_cb (ECalBackend *backend, gpointer data)
 	g_signal_handlers_disconnect_matched (backend, G_SIGNAL_MATCH_DATA,
 					      0, 0, NULL, NULL, data);
 
-	/* Notify upstream if there are no more backends */
-	if (g_hash_table_size (priv->backends) == 0)
-		g_signal_emit (G_OBJECT (factory), signals[LAST_CALENDAR_GONE], 0);
+	last_calendar = (g_hash_table_size (priv->backends) == 0);
 
 	g_mutex_unlock (priv->backends_mutex);
+
+	/* Notify upstream if there are no more backends */
+	if (last_calendar)
+		g_signal_emit (G_OBJECT (factory), signals[LAST_CALENDAR_GONE], 0);
 }
 
 
