[git] GpgOL - branch, master, updated. gpgol-2.2.0-67-g5e2078d

by Andre Heinecke cvs at cvs.gnupg.org
Wed Jul 18 14:34:39 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  5e2078d4f6686823d9a6c7a69490ccf02144ce4c (commit)
      from  7f050d64eabf781a737b1890c839d64a51c6bef6 (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 5e2078d4f6686823d9a6c7a69490ccf02144ce4c
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jul 18 14:32:40 2018 +0200

    Only shutdown for the last explorer close
    
    * src/windowmessages.cpp (gpgol_hook): Only shutdown if
    the last explorer is closed.
    
    --
    This acidentally mostly worked before as we only registered
    the first explorer for this function in the past.
    
    Also added a comment remembering what this function actually
    intends and why it is needed.

diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp
index 76f29b8..3861127 100644
--- a/src/windowmessages.cpp
+++ b/src/windowmessages.cpp
@@ -322,6 +322,10 @@ gpgol_hook(int code, WPARAM wParam, LPARAM lParam)
    before it reaches outlook. */
   LPCWPSTRUCT cwp = (LPCWPSTRUCT) lParam;
 
+  /* What we do here is that we catch all WM_CLOSE messages that
+     get to Outlook. Then we check if the last open Explorer
+     is the target of the close. In set case we start our shutdown
+     routine before we pass the WM_CLOSE to outlook */
   switch (cwp->message)
     {
       case WM_CLOSE:
@@ -345,42 +349,46 @@ gpgol_hook(int code, WPARAM wParam, LPARAM lParam)
           }
         int count = get_oom_int (explorers, "Count");
 
-        for (int i = 1; i <= count; i++)
+        if (count != 1)
           {
-            std::string item = "Item(";
-            item += std::to_string (i) + ")";
-            LPDISPATCH explorer = get_oom_object (explorers, item.c_str());
+            log_debug ("%s:%s: More then one explorer. Not shutting down.",
+                       SRCNAME, __func__);
+            gpgol_release (explorers);
+            break;
+          }
+
+        LPDISPATCH explorer = get_oom_object (explorers, "Item(1)");
+        gpgol_release (explorers);
 
-            if (!explorer)
-              {
-                TRACEPOINT;
-                break;
-              }
+        if (!explorer)
+          {
+            TRACEPOINT;
+            break;
+          }
 
-            /* Casting to LPOLEWINDOW and calling GetWindow
-               succeeded in Outlook 2016 but always returned
-               the number 1. So we need this hack. */
-            char *caption = get_oom_string (explorer, "Caption");
-            gpgol_release (explorer);
-            if (!caption)
-              {
-                log_debug ("%s:%s: No caption.",
-                           SRCNAME, __func__);
-                continue;
-              }
-            /* rctrl_renwnd32 is the window class of outlook. */
-            HWND hwnd = FindWindowExA(NULL, lastChild, "rctrl_renwnd32",
-                                      caption);
-            xfree (caption);
-            lastChild = hwnd;
-            if (hwnd == cwp->hwnd)
-              {
-                log_debug ("%s:%s: WM_CLOSE windowmessage for explorer. "
-                           "Shutting down.",
-                           SRCNAME, __func__);
-                GpgolAddin::get_instance ()->shutdown();
-                break;
-              }
+        /* Casting to LPOLEWINDOW and calling GetWindow
+           succeeded in Outlook 2016 but always returned
+           the number 1. So we need this hack. */
+        char *caption = get_oom_string (explorer, "Caption");
+        gpgol_release (explorer);
+        if (!caption)
+          {
+            log_debug ("%s:%s: No caption.",
+                       SRCNAME, __func__);
+            break;
+          }
+        /* rctrl_renwnd32 is the window class of outlook. */
+        HWND hwnd = FindWindowExA(NULL, lastChild, "rctrl_renwnd32",
+                                  caption);
+        xfree (caption);
+        lastChild = hwnd;
+        if (hwnd == cwp->hwnd)
+          {
+            log_debug ("%s:%s: WM_CLOSE windowmessage for explorer. "
+                       "Shutting down.",
+                       SRCNAME, __func__);
+            GpgolAddin::get_instance ()->shutdown();
+            break;
           }
         break;
       }

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

Summary of changes:
 src/windowmessages.cpp | 74 ++++++++++++++++++++++++++++----------------------
 1 file changed, 41 insertions(+), 33 deletions(-)


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




More information about the Gnupg-commits mailing list