[git] GpgOL - branch, master, updated. gpgol-2.0.1-14-gc5ed287

by Andre Heinecke cvs at cvs.gnupg.org
Wed Nov 15 16:22:29 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  c5ed287937bbcb894549fd4ec4ac696425189aea (commit)
       via  af005db32d2fd79f846a91e4fa7a100ca6e767b8 (commit)
       via  aebf5de38aab89136aff4e2c6cf49b7248eaa8ba (commit)
       via  eb035a2e69944dfce39c62d96d51f8459bb3386b (commit)
      from  8733e4d426bb9cdb8cce1db3e4ca67b656b27710 (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 c5ed287937bbcb894549fd4ec4ac696425189aea
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Nov 15 16:14:56 2017 +0100

    Ugly fix for ugly crash when pasting recipients
    
    * src/mailitem-events.cpp (do_delayed_locate): Delay
    a RECIPIENT_ADDED Signal.
    (EVENT_SINK_INVOKE): Only trigger once per change. Invoke
    delayed thread.
    * src/windowmessages.cpp (gpgol_window_proc): Handle
    Recipient Added signal.
    
    --
    This is a fix for crashes that happend if a resolved recipient
    is copied and pasted.
    If we then access the recipients object in the Property
    Change event Outlook says no (crash). Thus we do the delay dance.

diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index 0772004..36b4542 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -102,6 +102,14 @@ MailItemEvents::~MailItemEvents()
 
 static bool propchangeWarnShown = false;
 
+static DWORD WINAPI
+do_delayed_locate (LPVOID arg)
+{
+  Sleep(100);
+  do_in_ui_thread (RECIPIENT_ADDED, arg);
+  return 0;
+}
+
 /* The main Invoke function. The return value of this
    function does not appear to have any effect on outlook
    although I have read in an example somewhere that you
@@ -239,13 +247,22 @@ EVENT_SINK_INVOKE(MailItemEvents)
                 {
                   break;
                 }
-              if (!wcscmp (prop_name, L"To") ||
+              if (!wcscmp (prop_name, L"To") /* ||
                   !wcscmp (prop_name, L"BCC") ||
-                  !wcscmp (prop_name, L"CC"))
+                  !wcscmp (prop_name, L"CC")
+                  Testing shows that Outlook always sends these three in a row
+                  */)
                 {
                   if ((m_mail->needs_crypto() & 1))
                     {
-                      m_mail->locate_keys();
+                      /* XXX Racy race. This is a fix for crashes
+                         that happend if a resolved recipient is copied an pasted.
+                         If we then access the recipients object in the Property
+                         Change event we crash. Thus we do the delay dance. */
+                      HANDLE thread = CreateThread (NULL, 0, do_delayed_locate,
+                                                    (LPVOID) m_mail, 0,
+                                                    NULL);
+                      CloseHandle(thread);
                     }
                 }
               break;
diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp
index 1741a33..316e00e 100644
--- a/src/windowmessages.cpp
+++ b/src/windowmessages.cpp
@@ -55,6 +55,18 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
               mail->parsing_done();
               break;
             }
+          case (RECIPIENT_ADDED):
+            {
+              auto mail = (Mail*) ctx->data;
+              if (!Mail::is_valid_ptr (mail))
+                {
+                  log_debug ("%s:%s: Recipient add for mail which is gone.",
+                             SRCNAME, __func__);
+                  break;
+                }
+              mail->locate_keys();
+              break;
+            }
           case (INVALIDATE_UI):
             {
               log_debug ("%s:%s: Invalidating UI",
diff --git a/src/windowmessages.h b/src/windowmessages.h
index 281a3b8..6e875d7 100644
--- a/src/windowmessages.h
+++ b/src/windowmessages.h
@@ -40,6 +40,8 @@ typedef enum _gpgol_wmsg_type
   INVALIDATE_UI = 1, /* The UI should be invalidated. */
   PARSING_DONE = 2, /* A mail was parsed. Data should be a pointer
                       to the mail object. */
+  RECIPIENT_ADDED = 3, /* A recipient was added. Data should be ptr
+                          to mail */
 } gpgol_wmsg_type;
 
 typedef struct

commit af005db32d2fd79f846a91e4fa7a100ca6e767b8
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Nov 15 16:10:49 2017 +0100

    Lock key lookup map
    
    * src/mail.cpp (do_locate): Comment out useless message.
    (Mail::locate_keys): Guard list access with lock.
    
    --
    Does not really fix a bug but noticed a race there when
    codestaring.

diff --git a/src/mail.cpp b/src/mail.cpp
index 73e66a6..4862b38 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -2130,13 +2130,16 @@ do_locate (LPVOID arg)
                  SRCNAME, __func__, recipient);
     }
   xfree (recipient);
-  do_in_ui_thread (UNKNOWN, NULL);
+  // do_in_ui_thread (UNKNOWN, NULL);
   return 0;
 }
 
+GPGRT_LOCK_DEFINE(uids_searched_lock);
+
 /** Try to locate the keys for all recipients */
 void Mail::locate_keys()
 {
+  gpgrt_lock_lock (&uids_searched_lock);
   char ** recipients = get_recipients ();
 
   if (!recipients)
@@ -2158,6 +2161,7 @@ void Mail::locate_keys()
       xfree (recipients[i]);
     }
   xfree (recipients);
+  gpgrt_lock_unlock (&uids_searched_lock);
 }
 
 bool

commit aebf5de38aab89136aff4e2c6cf49b7248eaa8ba
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Nov 15 16:10:01 2017 +0100

    Fix ref leak of recipients obj
    
    * src/mail.cpp (get_recipients): Unref recipients obj.

diff --git a/src/mail.cpp b/src/mail.cpp
index 9db7c85..73e66a6 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -1256,7 +1256,9 @@ Mail::get_recipients() const
       TRACEPOINT;
       return nullptr;
     }
-  return get_oom_recipients (recipients);
+  auto ret = get_oom_recipients (recipients);
+  gpgol_release (recipients);
+  return ret;
 }
 
 int

commit eb035a2e69944dfce39c62d96d51f8459bb3386b
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Nov 15 14:34:25 2017 +0100

    Typos and spelling in comment about last commit
    
    --

diff --git a/src/explorer-events.cpp b/src/explorer-events.cpp
index 2e457ab..1529a88 100644
--- a/src/explorer-events.cpp
+++ b/src/explorer-events.cpp
@@ -83,11 +83,12 @@ EVENT_SINK_INVOKE(ExplorerEvents)
           log_oom_extra ("%s:%s: Selection change in explorer: %p",
                          SRCNAME, __func__, this);
 #if 0
-          This is fragile. Somehow. Accessing the current view of the
-          Explorer might crash outlook. This is even reproducable with
-          GpgOL enabled and only with Outlook Spy. If you select
+          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 outlook crashes.
+          the CurrentView and close the CurrentView again in Outlook Spy
+          outlook crashes.
 
           LPDISPATCH tableView = get_oom_object (m_object, "CurrentView");
           if (!tableView)

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

Summary of changes:
 src/explorer-events.cpp |  9 +++++----
 src/mail.cpp            | 10 ++++++++--
 src/mailitem-events.cpp | 23 ++++++++++++++++++++---
 src/windowmessages.cpp  | 12 ++++++++++++
 src/windowmessages.h    |  2 ++
 5 files changed, 47 insertions(+), 9 deletions(-)


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




More information about the Gnupg-commits mailing list