[evolution-ews] Bug 695754 - Reuse existing ESourceRegistry from EMailSession, if possible



commit fc99a074c7db3451ecfb740b1067e8fa15cbc058
Author: Milan Crha <mcrha redhat com>
Date:   Fri Dec 12 11:14:05 2014 +0100

    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.

 src/camel/camel-ews-store.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
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)));


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