From 6a5a2d75a9484b482546d4ed51fa6488d7e2c95a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 12 Dec 2014 11:14:05 +0100 Subject: Bug 695754 - Reuse existing ESourceRegistry from EMailSession, if possible Using a new ESourceRegistry and freeing is slightly afterwards could left some unfinished operations in the sourec registry's main_context. A change for this lands in evolution-data-server, but better to change also evolution-ews, to not create the source registry when not necessary. diff --git a/src/camel/camel-ews-store.c b/src/camel/camel-ews-store.c index ad82405..5cd46dc 100644 --- a/src/camel/camel-ews-store.c +++ b/src/camel/camel-ews-store.c @@ -1603,12 +1603,19 @@ static void ews_store_maybe_update_sent_and_drafts (CamelEwsStore *ews_store, /* const */ GSList *ews_folders) { + CamelSession *session; ESourceRegistry *registry; ESource *sibling, *source = NULL; g_return_if_fail (CAMEL_IS_EWS_STORE (ews_store)); - registry = e_source_registry_new_sync (NULL, NULL); + session = camel_service_ref_session (CAMEL_SERVICE (ews_store)); + if (session && E_IS_MAIL_SESSION (session)) + registry = g_object_ref (e_mail_session_get_registry (E_MAIL_SESSION (session))); + else + registry = e_source_registry_new_sync (NULL, NULL); + g_clear_object (&session); + g_return_if_fail (registry != NULL); sibling = e_source_registry_ref_source (registry, camel_service_get_uid (CAMEL_SERVICE (ews_store))); -- cgit v0.10.1