[git] GpgOL - branch, nomapi, updated. gpgol-1.4.0-146-gfd27fa2
by Andre Heinecke
cvs at cvs.gnupg.org
Tue Nov 8 18:16:24 CET 2016
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, nomapi has been updated
via fd27fa2fc04ba2172e4007b472d000153286b311 (commit)
from 7ba4f6e43ffc999945f7c9298b44572d237723e4 (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 fd27fa2fc04ba2172e4007b472d000153286b311
Author: Andre Heinecke <aheinecke at intevation.de>
Date: Tue Nov 8 18:13:35 2016 +0100
Only decrypt / verify one mail at once
* src/mail.cpp (do_parsing): Lock parsing
--
This fixes some threading problems when there were very
quick mail switches but it also makes the code more stable
and improves performance as it filters out parser calls
for mails that were already unloaded.
diff --git a/src/mail.cpp b/src/mail.cpp
index 4f8fb7b..a727b23 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -39,6 +39,7 @@
#include <gpgme++/verificationresult.h>
#include <gpgme++/decryptionresult.h>
#include <gpgme++/key.h>
+#include <gpg-error.h>
#include <map>
#include <vector>
@@ -460,10 +461,12 @@ add_attachments(LPDISPATCH mail,
return 0;
}
+GPGRT_LOCK_DEFINE(parser_lock);
+
static DWORD WINAPI
do_parsing (LPVOID arg)
{
- log_debug ("%s:%s: starting the parser for: %p",
+ log_debug ("%s:%s: preparing the parser for: %p",
SRCNAME, __func__, arg);
Mail *mail = (Mail *)arg;
@@ -474,8 +477,22 @@ do_parsing (LPVOID arg)
SRCNAME, __func__, arg);
return -1;
}
- parser->parse();
- do_in_ui_thread (PARSING_DONE, arg);
+ gpgrt_lock_lock (&parser_lock);
+ /* Serialize here to avoid too many
+ decryption attempts if there are
+ multiple mailobjects which might have already
+ been deleted (e.g. by quick switches of the mailview. */
+ if (Mail::is_valid_ptr (mail))
+ {
+ parser->parse();
+ do_in_ui_thread (PARSING_DONE, arg);
+ }
+ else
+ {
+ log_debug ("%s:%s: canceling parsing for: %p already deleted",
+ SRCNAME, __func__, arg);
+ }
+ gpgrt_lock_unlock (&parser_lock);
return 0;
}
-----------------------------------------------------------------------
Summary of changes:
src/mail.cpp | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
hooks/post-receive
--
GnuPG extension for MS Outlook
http://git.gnupg.org
More information about the Gnupg-commits
mailing list