[evolution-data-server] Load ESourceCredentialsProvider modules only once



commit de72d8dde800771591b9327f3aa89f5111f54d9f
Author: Milan Crha <mcrha redhat com>
Date:   Thu Feb 19 14:44:31 2015 +0100

    Load ESourceCredentialsProvider modules only once
    
    Each new instance loaded loadable modules, which were registering
    its types, but these types were not merged with those previous, GLib
    claims errors on the console instead. To avoid that, remember whether
    the modules were already loaded and do not load them again.

 libedataserver/e-source-credentials-provider.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/libedataserver/e-source-credentials-provider.c b/libedataserver/e-source-credentials-provider.c
index d9b2271..c18f4e7 100644
--- a/libedataserver/e-source-credentials-provider.c
+++ b/libedataserver/e-source-credentials-provider.c
@@ -121,14 +121,21 @@ source_credentials_provider_get_property (GObject *object,
 static void
 source_credentials_provider_constructed (GObject *object)
 {
+       static gboolean modules_loaded = FALSE;
        ESourceCredentialsProvider *provider = E_SOURCE_CREDENTIALS_PROVIDER (object);
-       GList *module_types;
 
        /* Chain up to parent's method. */
        G_OBJECT_CLASS (e_source_credentials_provider_parent_class)->constructed (object);
 
-       module_types = e_module_load_all_in_directory (E_DATA_SERVER_CREDENTIALMODULEDIR);
-       g_list_free_full (module_types, (GDestroyNotify) g_type_module_unuse);
+       /* Load modules only once. */
+       if (!modules_loaded) {
+               GList *module_types;
+
+               modules_loaded = TRUE;
+
+               module_types = e_module_load_all_in_directory (E_DATA_SERVER_CREDENTIALMODULEDIR);
+               g_list_free_full (module_types, (GDestroyNotify) g_type_module_unuse);
+       }
 
        e_extensible_load_extensions (E_EXTENSIBLE (object));
 


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