[git] GpgOL - branch, master, updated. gpgol-1.2.0-108-g1362563

by Andre Heinecke cvs at cvs.gnupg.org
Thu Nov 19 17:50:34 CET 2015


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  1362563c9370cc9c00463293a7f6eeb91b9424de (commit)
      from  36547fa3ff1c40d6b4b1204f44d3c0966354c73d (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 1362563c9370cc9c00463293a7f6eeb91b9424de
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Nov 19 17:42:50 2015 +0100

    Fix DllCanUnloadNow behavior
    
    * src/gpgoladdin.cpp (DllCanUnloadNow): Only return OK if the addin
    is not connected.
    
    --
    The addinlocks variable made no sense to use for this. Now we just
    check if we are connected or not. When we are not connected no
    callbacks are used and it is safe to unload gpgol. Otherwise
    we can't be safely unloaded.
    
    GnuPG-Bug-Id: 1837

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index 269c2af..5496eed 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -61,6 +61,8 @@
 
 ULONG addinLocks = 0;
 
+bool can_unload = false;
+
 /* This is the main entry point for the addin
    Outlook uses this function to query for an Object implementing
    the IClassFactory interface.
@@ -92,7 +94,13 @@ STDAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID* ppvObj)
 
 STDAPI DllCanUnloadNow()
 {
-    return addinLocks == 0 ? S_OK : S_FALSE;
+  /* This is called regularly to check if memory can be freed
+     by unloading the dll. The following unload will not call
+     any addin methods like disconnect etc. It will just
+     unload the Library. Any callbacks will become invalid.
+     So we _only_ say it's ok to unload if we were disconnected.
+     For the epic story behind the next line see GnuPG-Bug-Id 1837 */
+  return can_unload ? S_OK : S_FALSE;
 }
 
 /* Class factory */
@@ -228,6 +236,7 @@ GpgolAddin::OnConnection (LPDISPATCH Application, ext_ConnectMode ConnectMode,
   log_debug ("%s:%s:   in Outlook %s\n",
              SRCNAME, __func__, gpgme_check_version (NULL));
 
+  can_unload = false;
   m_application = Application;
   m_application->AddRef();
   m_addin = AddInInst;
@@ -285,6 +294,7 @@ GpgolAddin::OnDisconnection (ext_DisconnectMode RemoveMode,
     }
 
   write_options();
+  can_unload = true;
   return S_OK;
 }
 

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

Summary of changes:
 src/gpgoladdin.cpp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)


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




More information about the Gnupg-commits mailing list