[git] GpgOL - branch, master, updated. gpgol-2.2.0-59-gd719c98

by Andre Heinecke cvs at cvs.gnupg.org
Tue Jul 17 15:05:55 CEST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".

The branch, master has been updated
       via  d719c98902827d07af7619c9d19b4f2752bd0862 (commit)
      from  514a0d5d0a1fba979fb2f774aa3b1d241c64cf17 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d719c98902827d07af7619c9d19b4f2752bd0862
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Jul 17 15:04:19 2018 +0200

    Load gpgconf in a background thread
    
    * src/cpphelp.cpp (is_de_vs): Set checked earlier for
    better reentrancy.
    * src/gpgoladdin.cpp (OnStartupComplete): init_gpgme_config.
    
    --
    GpgME++ already handles caching for us. All we have to
    do is trigger loading early and in a non-blocking manner.

diff --git a/src/cpphelp.cpp b/src/cpphelp.cpp
index c09b16d..20e4794 100644
--- a/src/cpphelp.cpp
+++ b/src/cpphelp.cpp
@@ -112,6 +112,7 @@ in_de_vs_mode()
     {
       return vs_mode;
     }
+  checked = true;
   GpgME::Error err;
   const auto components = GpgME::Configuration::Component::load (err);
   log_debug ("%s:%s: Checking for de-vs mode.",
@@ -120,7 +121,6 @@ in_de_vs_mode()
     {
       log_error ("%s:%s: Failed to get gpgconf components: %s",
                  SRCNAME, __func__, err.asString ());
-      checked = true;
       vs_mode = false;
       return vs_mode;
     }
@@ -136,17 +136,14 @@ in_de_vs_mode()
                 {
                   log_debug ("%s:%s: Detected de-vs mode",
                              SRCNAME, __func__);
-                  checked = true;
                   vs_mode = true;
                   return vs_mode;
                 }
             }
-          checked = true;
           vs_mode = false;
           return vs_mode;
         }
     }
-  checked = true;
   vs_mode = false;
   return false;
 }
diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index 7d85267..220602b 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -46,6 +46,7 @@
 #include "windowmessages.h"
 #include "mail.h"
 #include "addin-options.h"
+#include "cpphelp.h"
 
 #include <gpg-error.h>
 #include <list>
@@ -458,6 +459,18 @@ install_explorer_sinks (LPDISPATCH application)
   return install_ExplorersEvents_sink (explorers);
 }
 
+static DWORD WINAPI
+init_gpgme_config (LPVOID)
+{
+  /* This is a check we need to do anyway. GpgME++ caches
+     the configuration once it is accessed for the first time
+     so this call also initializes GpgME++ */
+  bool de_vs_mode = in_de_vs_mode ();
+  log_debug ("%s:%s: init_gpgme_config de_vs_mode %i",
+             SRCNAME, __func__, de_vs_mode);
+  return 0;
+}
+
 STDMETHODIMP
 GpgolAddin::OnStartupComplete (SAFEARRAY** custom)
 {
@@ -495,6 +508,9 @@ GpgolAddin::OnStartupComplete (SAFEARRAY** custom)
   m_applicationEventSink = install_ApplicationEvents_sink (m_application);
   m_explorersEventSink = install_explorer_sinks (m_application);
   check_html_preferred ();
+
+  CloseHandle (CreateThread (NULL, 0, init_gpgme_config, nullptr, 0,
+                             NULL));
   return S_OK;
 }
 

-----------------------------------------------------------------------

Summary of changes:
 src/cpphelp.cpp    |  5 +----
 src/gpgoladdin.cpp | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
GnuPG extension for MS Outlook
http://git.gnupg.org




More information about the Gnupg-commits mailing list