[git] GpgOL - branch, master, updated. gpgol-2.0.6-11-g456cdf6

by Andre Heinecke cvs at cvs.gnupg.org
Tue Feb 27 07:09:02 CET 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  456cdf6165ef012769058507b5ef3edde729ca47 (commit)
      from  14d0e2d9d1e0f058ee391363aeee67614d9a7734 (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 456cdf6165ef012769058507b5ef3edde729ca47
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Feb 27 07:06:32 2018 +0100

    Check first for view before accessing selection
    
    * src/ribbon-callbacks.cpp (get_mail_from_control): Only
    access the item selection after we checked if we have a
    preview pane / word editor.
    
    --
    The selection.Item(x) call can trigger a load / unload event
    cycle. This is expensive and should be avoided if not
    necessary. Also in the Outbox this somehow prevents
    sending a mail.
    
    GnuPG-Bug-Id: T3812

diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 8470db2..92c3e36 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -1458,29 +1458,7 @@ get_mail_from_control (LPDISPATCH ctrl, bool *none_selected)
     }
   else if (!strcmp (ctx_name.c_str(), "_Explorer"))
     {
-      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;
-        }
-      else if (g_ol_version_major >= 16)
+      if (g_ol_version_major >= 16)
         {
           // 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
@@ -1526,6 +1504,35 @@ get_mail_from_control (LPDISPATCH ctrl, bool *none_selected)
                 }
             }
         }
+      if (!*none_selected)
+        {
+          /* Accessing the selection item can trigger a load event
+             so we only do this here if we think that there might be
+             something visible / selected. To avoid triggering a load
+             if there is no content shown. */
+          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;
+            }
+        }
     }
 
   gpgol_release (context);

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

Summary of changes:
 src/ribbon-callbacks.cpp | 53 +++++++++++++++++++++++++++---------------------
 1 file changed, 30 insertions(+), 23 deletions(-)


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




More information about the Gnupg-commits mailing list