[git] GpgOL - branch, master, updated. gpgol-2.0.3-3-g4003b8a

by Andre Heinecke cvs at cvs.gnupg.org
Fri Nov 24 09:55:33 CET 2017


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  4003b8aecec32ccb468bccee32127340ba5405ed (commit)
      from  13950a98522818b27b3048617acb0282b65b54b3 (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 4003b8aecec32ccb468bccee32127340ba5405ed
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Nov 24 09:48:21 2017 +0100

    Improve / Fix UI Invalidation
    
    * src/explorers-events.cpp (EVENT_SINK_INVOKE): Don't cancel
    invalidation when preview is disabled. Call delayed_invalidate_ui.
    * src/mailitem-events.cpp (EVENT_SINK_INVOKE): Use
    delayed_invalidate_ui.
    * src/windowmessages.cpp (delayed_invalidate_ui): New.
    
    --
    This fixes invalidation in that it is no longer prevented
    if the reading pane is not found on selection change and by
    using the delay with a guard for an already happening
    invalidation it should fix loops / races of many invalidations.
    
    GnuPG-Bug-Id: T3523
    GnuPG-Bug-Id: T3535

diff --git a/src/explorer-events.cpp b/src/explorer-events.cpp
index 8ed0784..03969b1 100644
--- a/src/explorer-events.cpp
+++ b/src/explorer-events.cpp
@@ -62,16 +62,6 @@ typedef enum
     ViewSwitch = 0xF004
   } ExplorerEvent;
 
-static DWORD WINAPI
-invalidate_ui (LPVOID)
-{
-  /* We sleep here a bit to prevent invalidtion immediately
-     after the selection change before we have started processing
-     the mail. */
-  Sleep (1000);
-  do_in_ui_thread (INVALIDATE_UI, nullptr);
-  return 0;
-}
 
 EVENT_SINK_INVOKE(ExplorerEvents)
 {
@@ -82,39 +72,8 @@ EVENT_SINK_INVOKE(ExplorerEvents)
         {
           log_oom_extra ("%s:%s: Selection change in explorer: %p",
                          SRCNAME, __func__, this);
-          /* Somehow latest Outlook 2016 crashes when accessing the current view
-          of the Explorer. This is even reproducible with
-          GpgOL disabled and only with Outlook Spy active. If you select
-          the explorer of an Outlook.com resource and then access
-          the CurrentView and close the CurrentView again in Outlook Spy
-          outlook crashes. */
-
-          if (g_ol_version_major <= 15)
-            {
-              LPDISPATCH tableView = get_oom_object (m_object, "CurrentView");
-              if (!tableView)
-                {
-                  TRACEPOINT;
-                  break;
-                }
-              int hasReadingPane = get_oom_bool (tableView, "ShowReadingPane");
-              gpgol_release (tableView);
-              if (!hasReadingPane)
-                {
-                  break;
-                }
-            }
-          else
-            {
-              LPDISPATCH prevEdit = get_oom_object (m_object, "PreviewPane.WordEditor");
-              gpgol_release (prevEdit);
-              if (!prevEdit)
-                {
-                  break;
-                }
-            }
 
-          HANDLE thread = CreateThread (NULL, 0, invalidate_ui, (LPVOID) this, 0,
+          HANDLE thread = CreateThread (NULL, 0, delayed_invalidate_ui, (LPVOID) this, 0,
                                         NULL);
 
           if (!thread)
diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index 7797b1d..d703348 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -204,7 +204,8 @@ EVENT_SINK_INVOKE(MailItemEvents)
           if (!m_mail->is_crypto_mail())
             {
               /* Ensure that no wrong sigstatus is shown */
-              gpgoladdin_invalidate_ui ();
+              CloseHandle(CreateThread (NULL, 0, delayed_invalidate_ui, (LPVOID) this, 0,
+                                        NULL));
               break;
             }
           if (m_mail->set_uuid ())
diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index f787622..df5eb76 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -1468,6 +1468,14 @@ get_mail_from_control (LPDISPATCH ctrl, bool *none_selected)
           // Avoid showing wrong crypto state if we don't have a reading
           // pane. In that case the parser will finish for a mail which is gone
           // and the crypto state will not get updated.
+
+          //
+          // Somehow latest Outlook 2016 crashes when accessing the current view
+          // of the Explorer. This is even reproducible with
+          // GpgOL disabled and only with Outlook Spy active. If you select
+          // the explorer of an Outlook.com resource and then access
+          // the CurrentView and close the CurrentView again in Outlook Spy
+          // outlook crashes.
           LPDISPATCH prevEdit = get_oom_object (context, "PreviewPane.WordEditor");
           gpgol_release (prevEdit);
           if (!prevEdit)
diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp
index 316e00e..1259496 100644
--- a/src/windowmessages.cpp
+++ b/src/windowmessages.cpp
@@ -231,3 +231,27 @@ create_message_hook()
                            NULL,
                            GetCurrentThreadId());
 }
+
+GPGRT_LOCK_DEFINE(invalidate_lock);
+static bool invalidation_in_progress;
+
+DWORD WINAPI
+delayed_invalidate_ui (LPVOID)
+{
+  if (invalidation_in_progress)
+    {
+      log_debug ("%s:%s: Invalidation canceled as it is in progress.",
+                 SRCNAME, __func__);
+      return 0;
+    }
+  gpgrt_lock_lock(&invalidate_lock);
+  invalidation_in_progress = true;
+  /* We sleep here a bit to prevent invalidation immediately
+     after the selection change before we have started processing
+     the mail. */
+  Sleep (500);
+  do_in_ui_thread (INVALIDATE_UI, nullptr);
+  invalidation_in_progress = false;
+  gpgrt_lock_unlock(&invalidate_lock);
+  return 0;
+}
diff --git a/src/windowmessages.h b/src/windowmessages.h
index 6e875d7..cc1cb62 100644
--- a/src/windowmessages.h
+++ b/src/windowmessages.h
@@ -70,6 +70,9 @@ do_in_ui_thread (gpgol_wmsg_type type, void *data);
 HHOOK
 create_message_hook();
 
+DWORD WINAPI
+delayed_invalidate_ui (LPVOID);
+
 void add_explorer (LPDISPATCH explorer);
 void remove_explorer (LPDISPATCH explorer);
 

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

Summary of changes:
 src/explorer-events.cpp  | 43 +------------------------------------------
 src/mailitem-events.cpp  |  3 ++-
 src/ribbon-callbacks.cpp |  8 ++++++++
 src/windowmessages.cpp   | 24 ++++++++++++++++++++++++
 src/windowmessages.h     |  3 +++
 5 files changed, 38 insertions(+), 43 deletions(-)


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




More information about the Gnupg-commits mailing list