Blame SOURCES/evolution-ews-3.28.5-double-collection-backend-populate.patch

d8acc1
From f50530ad101b47d461a345ff2b8b295b86c05d3a Mon Sep 17 00:00:00 2001
d8acc1
From: Milan Crha <mcrha@redhat.com>
d8acc1
Date: Thu, 27 Sep 2018 10:51:05 +0200
d8acc1
Subject: Collection backend schedules two 'populate' requests after going
d8acc1
 online
d8acc1
d8acc1
ECollectionBackend base class makes sure the 'populate' method is called
d8acc1
after the backend itself goes online, thus there is no need to schedule
d8acc1
it in the descendant again.
d8acc1
d8acc1
Related to https://gitlab.gnome.org/GNOME/evolution-data-server/issues/36
d8acc1
d8acc1
diff --git a/src/collection/e-ews-backend.c b/src/collection/e-ews-backend.c
d8acc1
index 651694b7..d9a973af 100644
d8acc1
--- a/src/collection/e-ews-backend.c
d8acc1
+++ b/src/collection/e-ews-backend.c
d8acc1
@@ -48,7 +48,7 @@ struct _EEwsBackendPrivate {
d8acc1
 
d8acc1
 	gboolean need_update_folders;
d8acc1
 
d8acc1
-	gulong notify_online_id;
d8acc1
+	gulong source_changed_id;
d8acc1
 };
d8acc1
 
d8acc1
 struct _SyncFoldersClosure {
d8acc1
@@ -647,15 +647,21 @@ static void
d8acc1
 ews_backend_dispose (GObject *object)
d8acc1
 {
d8acc1
 	EEwsBackendPrivate *priv;
d8acc1
+	ESource *source;
d8acc1
 
d8acc1
 	priv = E_EWS_BACKEND_GET_PRIVATE (object);
d8acc1
 
d8acc1
+	source = e_backend_get_source (E_BACKEND (object));
d8acc1
+	if (source && priv->source_changed_id) {
d8acc1
+		g_signal_handler_disconnect (source, priv->source_changed_id);
d8acc1
+		priv->source_changed_id = 0;
d8acc1
+	}
d8acc1
+
d8acc1
 	g_hash_table_remove_all (priv->folders);
d8acc1
 
d8acc1
-	if (priv->connection != NULL) {
d8acc1
-		g_object_unref (priv->connection);
d8acc1
-		priv->connection = NULL;
d8acc1
-	}
d8acc1
+	g_mutex_lock (&priv->connection_lock);
d8acc1
+	g_clear_object (&priv->connection);
d8acc1
+	g_mutex_unlock (&priv->connection_lock);
d8acc1
 
d8acc1
 	/* Chain up to parent's dispose() method. */
d8acc1
 	G_OBJECT_CLASS (e_ews_backend_parent_class)->dispose (object);
d8acc1
@@ -770,12 +776,8 @@ ews_backend_populate (ECollectionBackend *backend)
d8acc1
 
d8acc1
 	ews_backend->priv->need_update_folders = TRUE;
d8acc1
 
d8acc1
-	if (!ews_backend->priv->notify_online_id) {
d8acc1
-		ews_backend->priv->notify_online_id = g_signal_connect (
d8acc1
-			backend, "notify::online",
d8acc1
-			G_CALLBACK (ews_backend_populate), NULL);
d8acc1
-
d8acc1
-		g_signal_connect (
d8acc1
+	if (!ews_backend->priv->source_changed_id) {
d8acc1
+		ews_backend->priv->source_changed_id = g_signal_connect (
d8acc1
 			source, "changed",
d8acc1
 			G_CALLBACK (ews_backend_source_changed_cb), ews_backend);
d8acc1
 	}