[git] GpgOL - branch, master, updated. gpgol-2.0.3-6-gc31d8cd

by Andre Heinecke cvs at cvs.gnupg.org
Fri Nov 24 14:32:38 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  c31d8cdb40af660f020be5161dcbb0f90728ec0f (commit)
       via  156907fa4ef5df02be1646234171d8450c79467a (commit)
       via  7783e7cc9d0ec34a7d70a800970f2e835fea8a72 (commit)
      from  4003b8aecec32ccb468bccee32127340ba5405ed (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 c31d8cdb40af660f020be5161dcbb0f90728ec0f
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Nov 24 14:28:53 2017 +0100

    Fix multiple selection performance
    
    * src/ribbon-callbacks.cpp (get_mail_from_control): Treat
    multiselection like no mail is selected.
    
    --
    Experiments with OutlookSpy and debug output have shown that
    the call:
        mailitem = get_oom_object (context, "Selection.Item(1)");
    triggered an ItemLoad event for each mail in a selection. This
    is fun when there are thousands of mails selected and can
    lead to out of resources. As a workaround for this Outlook
    bug we now treat multi selection as if no mail was selected
    and don't obtain the first item.
    
    GnuPG-Bug-Id: T3523
    GnuPG-Bug-Id: T3433

diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 9958e36..5af1215 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -1442,9 +1442,9 @@ get_mail_from_control (LPDISPATCH ctrl, bool *none_selected)
       return NULL;
     }
 
-  char *ctx_name = get_object_name (context);
+  const auto ctx_name = std::string (get_object_name (context));
 
-  if (!ctx_name)
+  if (ctx_name.empty())
     {
       log_error ("%s:%s: Failed to get context name",
                  SRCNAME, __func__);
@@ -1452,13 +1452,30 @@ get_mail_from_control (LPDISPATCH ctrl, bool *none_selected)
       return NULL;
 
     }
-  if (!strcmp (ctx_name, "_Inspector"))
+  if (!strcmp (ctx_name.c_str(), "_Inspector"))
     {
       mailitem = get_oom_object (context, "CurrentItem");
     }
-  else if (!strcmp (ctx_name, "_Explorer"))
+  else if (!strcmp (ctx_name.c_str(), "_Explorer"))
     {
-      mailitem = get_oom_object (context, "Selection.Item(1)");
+      LPDISPATCH selection = get_oom_object (context, "Selection");
+      if (!selection)
+        {
+          log_error ("%s:%s: Failed to get selection.",
+                     SRCNAME, __func__);
+          gpgol_release (context);
+          return NULL;
+        }
+      int count = get_oom_int (selection, "Count");
+      if (count == 1)
+        {
+          // If we call this on a selection with more items
+          // Outlook sends an ItemLoad event for each mail
+          // in that selection.
+          mailitem = get_oom_object (selection, "Item(1)");
+        }
+      gpgol_release (selection);
+
       if (!mailitem)
         {
           *none_selected = true;
@@ -1514,12 +1531,10 @@ get_mail_from_control (LPDISPATCH ctrl, bool *none_selected)
   gpgol_release (context);
   if (!mailitem)
     {
-      log_error ("%s:%s: Failed to get mailitem. From %s",
-                 SRCNAME, __func__, ctx_name);
-      xfree (ctx_name);
+      log_debug ("%s:%s: No mailitem. From %s",
+                 SRCNAME, __func__, ctx_name.c_str());
       return NULL;
     }
-  xfree (ctx_name);
 
   char *uid;
   /* Get the uid of this item. */

commit 156907fa4ef5df02be1646234171d8450c79467a
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Nov 24 14:26:59 2017 +0100

    Additional check for mail destruction before parse
    
    * src/mail.cpp (do_parsing): Check if mail was deleted while
    waiting for lock.
    
    --
    This is a performance improvement when switching very fast
    through crypto mails.

diff --git a/src/mail.cpp b/src/mail.cpp
index 5da75a7..626809c 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -662,6 +662,14 @@ do_parsing (LPVOID arg)
   log_debug ("%s:%s: preparing the parser for: %p",
              SRCNAME, __func__, arg);
 
+  if (!Mail::is_valid_ptr (mail))
+    {
+      log_debug ("%s:%s: cancel for: %p already deleted",
+                 SRCNAME, __func__, arg);
+      gpgrt_lock_unlock (&parser_lock);
+      return 0;
+    }
+
   if (!parser)
     {
       log_error ("%s:%s: no parser found for mail: %p",

commit 7783e7cc9d0ec34a7d70a800970f2e835fea8a72
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Nov 24 11:03:18 2017 +0100

    Remove some disabled OL 2007 compat
    
    --

diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index d703348..e45299d 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -185,20 +185,6 @@ EVENT_SINK_INVOKE(MailItemEvents)
         }
       case Read:
         {
-          if (g_ol_version_major < 14)
-            {
-              /* In Outlook 2007 there is no Before read event.
-                 We change the message class in message-events to
-                 prevent that outlook parses the mail itself but
-                 we still need to update our mail object accordingly.
-                 So we call pre_process here gain although the message
-                 class already was changed. */
-              if (m_mail->pre_process_message ())
-                {
-                  log_error ("%s:%s: Pre process message failed.",
-                             SRCNAME, __func__);
-                }
-            }
           log_oom_extra ("%s:%s: Read : %p",
                          SRCNAME, __func__, m_mail);
           if (!m_mail->is_crypto_mail())
diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index df5eb76..9958e36 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -1468,7 +1468,7 @@ 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

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

Summary of changes:
 src/mail.cpp             |  8 ++++++++
 src/mailitem-events.cpp  | 14 --------------
 src/ribbon-callbacks.cpp | 35 +++++++++++++++++++++++++----------
 3 files changed, 33 insertions(+), 24 deletions(-)


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




More information about the Gnupg-commits mailing list