[git] GpgOL - branch, master, updated. gpgol-2.3.0-73-g04b0965
by Andre Heinecke
cvs at cvs.gnupg.org
Mon Oct 8 17:57:35 CEST 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 04b0965b212221c2bcbc6edf00971721caa9df60 (commit)
from d04de205a89ef617b31c45f6cf144393f6e9ee36 (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 04b0965b212221c2bcbc6edf00971721caa9df60
Author: Andre Heinecke <aheinecke at intevation.de>
Date: Mon Oct 8 16:13:34 2018 +0200
Add lock tracing
* src/debug.h (gpgol_lock, gpgol_unlock): Add tracing makros.
* src/*.cpp: Use them.
--
This adds lock tracing everywhere except memdbg as tracing
there would be too verbose.
Because deadlocks from race conditions are so hard to
debug it's better if we have the capabilities to anylyse them.
diff --git a/src/debug.cpp b/src/debug.cpp
index c453b39..88e2923 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -332,7 +332,7 @@ const char *anonstr (const char *data)
return "gpgol_str_empty";
}
- gpgrt_lock_lock (&anon_str_lock);
+ gpgol_lock (&anon_str_lock);
const std::string strData (data);
auto it = str_map.find (strData);
@@ -346,7 +346,7 @@ const char *anonstr (const char *data)
// As the data is saved in our map we can return
// the c_str as it won't be touched as const.
- gpgrt_lock_unlock (&anon_str_lock);
+ gpgol_unlock (&anon_str_lock);
return it->second.c_str();
}
diff --git a/src/debug.h b/src/debug.h
index 7b089ce..1d762b9 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -91,6 +91,28 @@ const char *anonstr (const char *data);
} \
}
+
+#define gpgol_lock(X) \
+{ \
+ if (opt.enable_debug & DBG_TRACE) \
+ { \
+ log_trace ("%s:%s:%i: lock %p lock", \
+ SRCNAME, __func__, __LINE__, X); \
+ } \
+ gpgrt_lock_lock(X); \
+}
+
+
+#define gpgol_unlock(X) \
+{ \
+ if (opt.enable_debug & DBG_TRACE) \
+ { \
+ log_trace ("%s:%s:%i: lock %p unlock.", \
+ SRCNAME, __func__, __LINE__, X); \
+ } \
+ gpgrt_lock_unlock(X); \
+}
+
const char *log_srcname (const char *s);
#define SRCNAME log_srcname (__FILE__)
diff --git a/src/dispcache.cpp b/src/dispcache.cpp
index 7b1bbf3..e26669e 100644
--- a/src/dispcache.cpp
+++ b/src/dispcache.cpp
@@ -41,7 +41,7 @@ public:
TRACEPOINT;
return;
}
- gpgrt_lock_lock (&cache_lock);
+ gpgol_lock (&cache_lock);
auto it = m_cache.find (id);
if (it != m_cache.end ())
{
@@ -49,11 +49,11 @@ public:
SRCNAME, __func__, id);
gpgol_release (it->second);
it->second = obj;
- gpgrt_lock_unlock (&cache_lock);
+ gpgol_unlock (&cache_lock);
return;
}
m_cache.insert (std::make_pair (id, obj));
- gpgrt_lock_unlock (&cache_lock);
+ gpgol_unlock (&cache_lock);
return;
}
@@ -64,27 +64,27 @@ public:
TRACEPOINT;
return nullptr;
}
- gpgrt_lock_lock (&cache_lock);
+ gpgol_lock (&cache_lock);
const auto it = m_cache.find (id);
if (it != m_cache.end())
{
LPDISPATCH ret = it->second;
- gpgrt_lock_unlock (&cache_lock);
+ gpgol_unlock (&cache_lock);
return ret;
}
- gpgrt_lock_unlock (&cache_lock);
+ gpgol_unlock (&cache_lock);
return nullptr;
}
~Private ()
{
- gpgrt_lock_lock (&cache_lock);
+ gpgol_lock (&cache_lock);
for (const auto it: m_cache)
{
gpgol_release (it.second);
}
- gpgrt_lock_unlock (&cache_lock);
+ gpgol_unlock (&cache_lock);
}
private:
diff --git a/src/explorer-events.cpp b/src/explorer-events.cpp
index 7ccedfd..6139460 100644
--- a/src/explorer-events.cpp
+++ b/src/explorer-events.cpp
@@ -125,7 +125,7 @@ start_watchdog (LPVOID arg)
LPDISPATCH explorer = (LPDISPATCH) arg;
Sleep (500);
- gpgrt_lock_lock (&explorer_map_lock);
+ gpgol_lock (&explorer_map_lock);
auto it = s_explorerMap.find (explorer);
@@ -133,7 +133,7 @@ start_watchdog (LPVOID arg)
{
log_error ("%s:%s: Watchdog for unknwon explorer %p",
SRCNAME, __func__, explorer);
- gpgrt_lock_unlock (&explorer_map_lock);
+ gpgol_unlock (&explorer_map_lock);
return 0;
}
@@ -148,11 +148,11 @@ start_watchdog (LPVOID arg)
log_debug ("%s:%s: Deteced unselect invalidating UI.",
SRCNAME, __func__);
it->second = UnselectSeen;
- gpgrt_lock_unlock (&explorer_map_lock);
+ gpgol_unlock (&explorer_map_lock);
do_in_ui_thread (INVALIDATE_UI, nullptr);
return 0;
}
- gpgrt_lock_unlock (&explorer_map_lock);
+ gpgol_unlock (&explorer_map_lock);
return 0;
}
@@ -160,7 +160,7 @@ start_watchdog (LPVOID arg)
static void
changeSeen (LPDISPATCH explorer)
{
- gpgrt_lock_lock (&explorer_map_lock);
+ gpgol_lock (&explorer_map_lock);
auto it = s_explorerMap.find (explorer);
@@ -192,7 +192,7 @@ changeSeen (LPDISPATCH explorer)
}
it->second = UnselectSeen + WatchDogActive;
}
- gpgrt_lock_unlock (&explorer_map_lock);
+ gpgol_unlock (&explorer_map_lock);
}
EVENT_SINK_INVOKE(ExplorerEvents)
@@ -213,9 +213,9 @@ EVENT_SINK_INVOKE(ExplorerEvents)
SRCNAME, __func__, this);
GpgolAddin::get_instance ()->unregisterExplorerSink (this);
- gpgrt_lock_lock (&explorer_map_lock);
+ gpgol_lock (&explorer_map_lock);
s_explorerMap.erase (m_object);
- gpgrt_lock_unlock (&explorer_map_lock);
+ gpgol_unlock (&explorer_map_lock);
delete this;
return S_OK;
}
diff --git a/src/keycache.cpp b/src/keycache.cpp
index 26a72ce..f0e635b 100644
--- a/src/keycache.cpp
+++ b/src/keycache.cpp
@@ -227,7 +227,7 @@ public:
void setPgpKey(const std::string &mbox, const GpgME::Key &key)
{
TSTART;
- gpgrt_lock_lock (&keycache_lock);
+ gpgol_lock (&keycache_lock);
auto it = m_pgp_key_map.find (mbox);
if (it == m_pgp_key_map.end ())
@@ -239,14 +239,14 @@ public:
it->second = key;
}
insertOrUpdateInFprMap (key);
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN;
}
void setSmimeKey(const std::string &mbox, const GpgME::Key &key)
{
TSTART;
- gpgrt_lock_lock (&keycache_lock);
+ gpgol_lock (&keycache_lock);
auto it = m_smime_key_map.find (mbox);
if (it == m_smime_key_map.end ())
@@ -258,14 +258,14 @@ public:
it->second = key;
}
insertOrUpdateInFprMap (key);
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN;
}
void setPgpKeySecret(const std::string &mbox, const GpgME::Key &key)
{
TSTART;
- gpgrt_lock_lock (&keycache_lock);
+ gpgol_lock (&keycache_lock);
auto it = m_pgp_skey_map.find (mbox);
if (it == m_pgp_skey_map.end ())
@@ -277,14 +277,14 @@ public:
it->second = key;
}
insertOrUpdateInFprMap (key);
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN;
}
void setSmimeKeySecret(const std::string &mbox, const GpgME::Key &key)
{
TSTART;
- gpgrt_lock_lock (&keycache_lock);
+ gpgol_lock (&keycache_lock);
auto it = m_smime_skey_map.find (mbox);
if (it == m_smime_skey_map.end ())
@@ -296,7 +296,7 @@ public:
it->second = key;
}
insertOrUpdateInFprMap (key);
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN;
}
@@ -311,11 +311,11 @@ public:
}
auto mbox = GpgME::UserID::addrSpecFromString (addr);
- gpgrt_lock_lock (&keycache_lock);
+ gpgol_lock (&keycache_lock);
const auto it = m_addr_book_overrides.find (mbox);
if (it == m_addr_book_overrides.end ())
{
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN ret;
}
for (const auto fpr: it->second)
@@ -330,7 +330,7 @@ public:
ret.push_back (key);
}
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN ret;
}
@@ -345,29 +345,29 @@ public:
if (proto == GpgME::OpenPGP)
{
- gpgrt_lock_lock (&keycache_lock);
+ gpgol_lock (&keycache_lock);
const auto it = m_pgp_key_map.find (mbox);
if (it == m_pgp_key_map.end ())
{
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN GpgME::Key();
}
const auto ret = it->second;
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN ret;
}
- gpgrt_lock_lock (&keycache_lock);
+ gpgol_lock (&keycache_lock);
const auto it = m_smime_key_map.find (mbox);
if (it == m_smime_key_map.end ())
{
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN GpgME::Key();
}
const auto ret = it->second;
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN ret;
}
@@ -383,29 +383,29 @@ public:
if (proto == GpgME::OpenPGP)
{
- gpgrt_lock_lock (&keycache_lock);
+ gpgol_lock (&keycache_lock);
const auto it = m_pgp_skey_map.find (mbox);
if (it == m_pgp_skey_map.end ())
{
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN GpgME::Key();
}
const auto ret = it->second;
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN ret;
}
- gpgrt_lock_lock (&keycache_lock);
+ gpgol_lock (&keycache_lock);
const auto it = m_smime_skey_map.find (mbox);
if (it == m_smime_skey_map.end ())
{
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN GpgME::Key();
}
const auto ret = it->second;
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN ret;
}
@@ -526,7 +526,7 @@ public:
TRACEPOINT;
TRETURN;
}
- gpgrt_lock_lock (&fpr_map_lock);
+ gpgol_lock (&fpr_map_lock);
/* First ensure that we have the subkeys mapped to the primary
fpr */
@@ -552,7 +552,7 @@ public:
{
m_fpr_map.insert (std::make_pair (primaryFpr, key));
- gpgrt_lock_unlock (&fpr_map_lock);
+ gpgol_unlock (&fpr_map_lock);
TRETURN;
}
@@ -568,7 +568,7 @@ public:
{
it->second = key;
}
- gpgrt_lock_unlock (&fpr_map_lock);
+ gpgol_unlock (&fpr_map_lock);
TRETURN;
}
@@ -581,7 +581,7 @@ public:
TRETURN GpgME::Key();
}
- gpgrt_lock_lock (&fpr_map_lock);
+ gpgol_lock (&fpr_map_lock);
std::string primaryFpr;
const auto it = m_sub_fpr_map.find (fpr);
if (it != m_sub_fpr_map.end ())
@@ -600,10 +600,10 @@ public:
if (keyIt != m_fpr_map.end ())
{
const auto ret = keyIt->second;
- gpgrt_lock_unlock (&fpr_map_lock);
+ gpgol_unlock (&fpr_map_lock);
TRETURN ret;
}
- gpgrt_lock_unlock (&fpr_map_lock);
+ gpgol_unlock (&fpr_map_lock);
TRETURN GpgME::Key();
}
@@ -627,7 +627,7 @@ public:
const std::string sFpr (fpr);
int i = 0;
- gpgrt_lock_lock (&update_lock);
+ gpgol_lock (&update_lock);
while (m_update_jobs.find(sFpr) != m_update_jobs.end ())
{
i++;
@@ -636,9 +636,9 @@ public:
log_debug ("%s:%s Waiting on update for \"%s\"",
SRCNAME, __func__, anonstr (fpr));
}
- gpgrt_lock_unlock (&update_lock);
+ gpgol_unlock (&update_lock);
Sleep (10);
- gpgrt_lock_lock (&update_lock);
+ gpgol_lock (&update_lock);
if (i == 3000)
{
/* Just to be on the save side */
@@ -648,7 +648,7 @@ public:
break;
}
}
- gpgrt_lock_unlock (&update_lock);
+ gpgol_unlock (&update_lock);
TRACEPOINT;
const auto ret2 = getFromMap (fpr);
@@ -682,16 +682,16 @@ public:
TRETURN;
}
const std::string sFpr (fpr);
- gpgrt_lock_lock (&update_lock);
+ gpgol_lock (&update_lock);
if (m_update_jobs.find(sFpr) != m_update_jobs.end ())
{
log_debug ("%s:%s Update for \"%s\" already in progress.",
SRCNAME, __func__, anonstr (fpr));
- gpgrt_lock_unlock (&update_lock);
+ gpgol_unlock (&update_lock);
}
m_update_jobs.insert (sFpr);
- gpgrt_lock_unlock (&update_lock);
+ gpgol_unlock (&update_lock);
update_arg_t * args = new update_arg_t;
args->first = sFpr;
args->second = proto;
@@ -710,18 +710,18 @@ public:
}
TRACEPOINT;
insertOrUpdateInFprMap (key);
- gpgrt_lock_lock (&update_lock);
+ gpgol_lock (&update_lock);
const auto it = m_update_jobs.find(fpr);
if (it == m_update_jobs.end())
{
log_error ("%s:%s Update for \"%s\" already finished.",
SRCNAME, __func__, anonstr (fpr));
- gpgrt_lock_unlock (&update_lock);
+ gpgol_unlock (&update_lock);
TRETURN;
}
m_update_jobs.erase (it);
- gpgrt_lock_unlock (&update_lock);
+ gpgol_unlock (&update_lock);
TRACEPOINT;
TRETURN;
}
@@ -735,15 +735,15 @@ public:
TRACEPOINT;
TRETURN;
}
- gpgrt_lock_lock (&import_lock);
+ gpgol_lock (&import_lock);
if (m_import_jobs.find (mbox) != m_import_jobs.end ())
{
log_debug ("%s:%s import for \"%s\" already in progress.",
SRCNAME, __func__, anonstr (mbox.c_str ()));
- gpgrt_lock_unlock (&import_lock);
+ gpgol_unlock (&import_lock);
}
m_import_jobs.insert (mbox);
- gpgrt_lock_unlock (&import_lock);
+ gpgol_unlock (&import_lock);
import_arg_t * args = new import_arg_t;
args->first = std::unique_ptr<LocateArgs> (new LocateArgs (mbox, mail));
@@ -759,7 +759,7 @@ public:
const std::vector<std::string> &result_fprs)
{
TSTART;
- gpgrt_lock_lock (&keycache_lock);
+ gpgol_lock (&keycache_lock);
auto it = m_addr_book_overrides.find (mbox);
if (it != m_addr_book_overrides.end ())
{
@@ -770,19 +770,19 @@ public:
m_addr_book_overrides.insert (
std::make_pair (mbox, result_fprs));
}
- gpgrt_lock_unlock (&keycache_lock);
- gpgrt_lock_lock (&import_lock);
+ gpgol_unlock (&keycache_lock);
+ gpgol_lock (&import_lock);
const auto job_it = m_import_jobs.find(mbox);
if (job_it == m_import_jobs.end())
{
log_error ("%s:%s import for \"%s\" already finished.",
SRCNAME, __func__, anonstr (mbox.c_str ()));
- gpgrt_lock_unlock (&import_lock);
+ gpgol_unlock (&import_lock);
TRETURN;
}
m_import_jobs.erase (job_it);
- gpgrt_lock_unlock (&import_lock);
+ gpgol_unlock (&import_lock);
TRETURN;
}
@@ -1028,7 +1028,7 @@ KeyCache::startLocate (const char *addr, Mail *mail) const
{
TRETURN;
}
- gpgrt_lock_lock (&keycache_lock);
+ gpgol_lock (&keycache_lock);
if (d->m_pgp_key_map.find (recp) == d->m_pgp_key_map.end ())
{
// It's enough to look at the PGP Key map. We marked
@@ -1042,7 +1042,7 @@ KeyCache::startLocate (const char *addr, Mail *mail) const
NULL);
CloseHandle (thread);
}
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN;
}
@@ -1060,7 +1060,7 @@ KeyCache::startLocateSecret (const char *addr, Mail *mail) const
{
TRETURN;
}
- gpgrt_lock_lock (&keycache_lock);
+ gpgol_lock (&keycache_lock);
if (d->m_pgp_skey_map.find (recp) == d->m_pgp_skey_map.end ())
{
// It's enough to look at the PGP Key map. We marked
@@ -1075,7 +1075,7 @@ KeyCache::startLocateSecret (const char *addr, Mail *mail) const
NULL);
CloseHandle (thread);
}
- gpgrt_lock_unlock (&keycache_lock);
+ gpgol_unlock (&keycache_lock);
TRETURN;
}
diff --git a/src/mail.cpp b/src/mail.cpp
index f30804ed..bfff980 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -124,9 +124,9 @@ Mail::Mail (LPDISPATCH mailitem) :
gpgol_release(mailitem);
TRETURN;
}
- gpgrt_lock_lock (&mail_map_lock);
+ gpgol_lock (&mail_map_lock);
s_mail_map.insert (std::pair<LPDISPATCH, Mail *> (mailitem, this));
- gpgrt_lock_unlock (&mail_map_lock);
+ gpgol_unlock (&mail_map_lock);
s_last_mail = this;
memdbg_ctor ("Mail");
TRETURN;
@@ -139,7 +139,7 @@ void
Mail::lockDelete ()
{
TSTART;
- gpgrt_lock_lock (&dtor_lock);
+ gpgol_lock (&dtor_lock);
TRETURN;
}
@@ -148,7 +148,7 @@ void
Mail::unlockDelete ()
{
TSTART;
- gpgrt_lock_unlock (&dtor_lock);
+ gpgol_unlock (&dtor_lock);
TRETURN;
}
@@ -160,7 +160,7 @@ Mail::~Mail()
thread. The shared_ptr of the parser then ensures
that the parser is alive even if the mail is deleted
while parsing. */
- gpgrt_lock_lock (&dtor_lock);
+ gpgol_lock (&dtor_lock);
memdbg_dtor ("Mail");
log_oom ("%s:%s: dtor: Mail: %p item: %p",
SRCNAME, __func__, this, m_mailitem);
@@ -173,23 +173,23 @@ Mail::~Mail()
log_oom ("%s:%s: Erasing mail",
SRCNAME, __func__);
- gpgrt_lock_lock (&mail_map_lock);
+ gpgol_lock (&mail_map_lock);
it = s_mail_map.find(m_mailitem);
if (it != s_mail_map.end())
{
s_mail_map.erase (it);
}
- gpgrt_lock_unlock (&mail_map_lock);
+ gpgol_unlock (&mail_map_lock);
if (!m_uuid.empty())
{
- gpgrt_lock_lock (&uid_map_lock);
+ gpgol_lock (&uid_map_lock);
auto it2 = s_uid_map.find(m_uuid);
if (it2 != s_uid_map.end())
{
s_uid_map.erase (it2);
}
- gpgrt_lock_unlock (&uid_map_lock);
+ gpgol_unlock (&uid_map_lock);
}
log_oom ("%s:%s: releasing mailitem",
@@ -213,7 +213,7 @@ Mail::~Mail()
m_crypter = nullptr;
releaseCurrentItem();
- gpgrt_lock_unlock (&dtor_lock);
+ gpgol_unlock (&dtor_lock);
log_oom ("%s:%s: returning",
SRCNAME, __func__);
TRETURN;
@@ -229,9 +229,9 @@ Mail::getMailForItem (LPDISPATCH mailitem)
TRETURN NULL;
}
std::map<LPDISPATCH, Mail *>::iterator it;
- gpgrt_lock_lock (&mail_map_lock);
+ gpgol_lock (&mail_map_lock);
it = s_mail_map.find(mailitem);
- gpgrt_lock_unlock (&mail_map_lock);
+ gpgol_unlock (&mail_map_lock);
if (it == s_mail_map.end())
{
TRETURN NULL;
@@ -248,9 +248,9 @@ Mail::getMailForUUID (const char *uuid)
{
TRETURN NULL;
}
- gpgrt_lock_lock (&uid_map_lock);
+ gpgol_lock (&uid_map_lock);
auto it = s_uid_map.find(std::string(uuid));
- gpgrt_lock_unlock (&uid_map_lock);
+ gpgol_unlock (&uid_map_lock);
if (it == s_uid_map.end())
{
TRETURN NULL;
@@ -263,18 +263,18 @@ bool
Mail::isValidPtr (const Mail *mail)
{
TSTART;
- gpgrt_lock_lock (&mail_map_lock);
+ gpgol_lock (&mail_map_lock);
auto it = s_mail_map.begin();
while (it != s_mail_map.end())
{
if (it->second == mail)
{
- gpgrt_lock_unlock (&mail_map_lock);
+ gpgol_unlock (&mail_map_lock);
TRETURN true;
}
++it;
}
- gpgrt_lock_unlock (&mail_map_lock);
+ gpgol_unlock (&mail_map_lock);
TRETURN false;
}
@@ -785,7 +785,7 @@ static DWORD WINAPI
do_parsing (LPVOID arg)
{
TSTART;
- gpgrt_lock_lock (&dtor_lock);
+ gpgol_lock (&dtor_lock);
/* We lock with mail dtors so we can be sure the mail->parser
call is valid. */
Mail *mail = (Mail *)arg;
@@ -793,7 +793,7 @@ do_parsing (LPVOID arg)
{
log_debug ("%s:%s: canceling parsing for: %p already deleted",
SRCNAME, __func__, arg);
- gpgrt_lock_unlock (&dtor_lock);
+ gpgol_unlock (&dtor_lock);
TRETURN 0;
}
@@ -801,9 +801,9 @@ do_parsing (LPVOID arg)
/* This takes a shared ptr of parser. So the parser is
still valid when the mail is deleted. */
auto parser = mail->parser ();
- gpgrt_lock_unlock (&dtor_lock);
+ gpgol_unlock (&dtor_lock);
- gpgrt_lock_lock (&parser_lock);
+ gpgol_lock (&parser_lock);
/* We lock the parser here to avoid too many
decryption attempts if there are
multiple mailobjects which might have already
@@ -817,7 +817,7 @@ do_parsing (LPVOID arg)
{
log_debug ("%s:%s: cancel for: %p already deleted",
SRCNAME, __func__, arg);
- gpgrt_lock_unlock (&parser_lock);
+ gpgol_unlock (&parser_lock);
unblockInv();
TRETURN 0;
}
@@ -826,7 +826,7 @@ do_parsing (LPVOID arg)
{
log_error ("%s:%s: no parser found for mail: %p",
SRCNAME, __func__, arg);
- gpgrt_lock_unlock (&parser_lock);
+ gpgol_unlock (&parser_lock);
unblockInv();
TRETURN -1;
}
@@ -835,7 +835,7 @@ do_parsing (LPVOID arg)
{
do_in_ui_thread (PARSING_DONE, arg);
}
- gpgrt_lock_unlock (&parser_lock);
+ gpgol_unlock (&parser_lock);
unblockInv();
TRETURN 0;
}
@@ -915,7 +915,7 @@ static DWORD WINAPI
do_crypt (LPVOID arg)
{
TSTART;
- gpgrt_lock_lock (&dtor_lock);
+ gpgol_lock (&dtor_lock);
/* We lock with mail dtors so we can be sure the mail->parser
call is valid. */
Mail *mail = (Mail *)arg;
@@ -923,7 +923,7 @@ do_crypt (LPVOID arg)
{
log_debug ("%s:%s: canceling crypt for: %p already deleted",
SRCNAME, __func__, arg);
- gpgrt_lock_unlock (&dtor_lock);
+ gpgol_unlock (&dtor_lock);
TRETURN 0;
}
if (mail->cryptState () != Mail::NeedsActualCrypt)
@@ -931,20 +931,20 @@ do_crypt (LPVOID arg)
log_debug ("%s:%s: invalid state %i",
SRCNAME, __func__, mail->cryptState ());
mail->setWindowEnabled_o (true);
- gpgrt_lock_unlock (&dtor_lock);
+ gpgol_unlock (&dtor_lock);
TRETURN -1;
}
/* This takes a shared ptr of crypter. So the crypter is
still valid when the mail is deleted. */
auto crypter = mail->cryper ();
- gpgrt_lock_unlock (&dtor_lock);
+ gpgol_unlock (&dtor_lock);
if (!crypter)
{
log_error ("%s:%s: no crypter found for mail: %p",
SRCNAME, __func__, arg);
- gpgrt_lock_unlock (&parser_lock);
+ gpgol_unlock (&parser_lock);
mail->setWindowEnabled_o (true);
TRETURN -1;
}
@@ -952,12 +952,12 @@ do_crypt (LPVOID arg)
GpgME::Error err;
int rc = crypter->do_crypto(err);
- gpgrt_lock_lock (&dtor_lock);
+ gpgol_lock (&dtor_lock);
if (!Mail::isValidPtr (mail))
{
log_debug ("%s:%s: aborting crypt for: %p already deleted",
SRCNAME, __func__, arg);
- gpgrt_lock_unlock (&dtor_lock);
+ gpgol_unlock (&dtor_lock);
TRETURN 0;
}
@@ -990,14 +990,14 @@ do_crypt (LPVOID arg)
mail->setCryptState (Mail::NoCryptMail);
mail->resetCrypter ();
crypter = nullptr;
- gpgrt_lock_unlock (&dtor_lock);
+ gpgol_unlock (&dtor_lock);
TRETURN rc;
}
if (!mail->isAsyncCryptDisabled ())
{
mail->setCryptState (Mail::NeedsUpdateInOOM);
- gpgrt_lock_unlock (&dtor_lock);
+ gpgol_unlock (&dtor_lock);
// This deletes the Mail in Outlook 2010
do_in_ui_thread (CRYPTO_DONE, arg);
log_debug ("%s:%s: UI thread finished for %p",
@@ -1020,7 +1020,7 @@ do_crypt (LPVOID arg)
crypter = nullptr;
mail->resetCrypter ();
}
- gpgrt_lock_unlock (&dtor_lock);
+ gpgol_unlock (&dtor_lock);
}
/* This works around a bug in pinentry that it might
bring the wrong window to front. So after encryption /
@@ -1757,9 +1757,9 @@ Mail::closeAllMails_o ()
std::map<LPDISPATCH, Mail *>::iterator it;
TRACEPOINT;
- gpgrt_lock_lock (&mail_map_lock);
+ gpgol_lock (&mail_map_lock);
std::map<LPDISPATCH, Mail *> mail_map_copy = s_mail_map;
- gpgrt_lock_unlock (&mail_map_lock);
+ gpgol_unlock (&mail_map_lock);
for (it = mail_map_copy.begin(); it != mail_map_copy.end(); ++it)
{
/* XXX For non racy code the is_valid_ptr check should not
@@ -1794,9 +1794,9 @@ Mail::revertAllMails_o ()
TSTART;
int err = 0;
std::map<LPDISPATCH, Mail *>::iterator it;
- gpgrt_lock_lock (&mail_map_lock);
+ gpgol_lock (&mail_map_lock);
auto mail_map_copy = s_mail_map;
- gpgrt_lock_unlock (&mail_map_lock);
+ gpgol_unlock (&mail_map_lock);
for (it = mail_map_copy.begin(); it != mail_map_copy.end(); ++it)
{
if (it->second->revert_o ())
@@ -1823,9 +1823,9 @@ Mail::wipeAllMails_o ()
TSTART;
int err = 0;
std::map<LPDISPATCH, Mail *>::iterator it;
- gpgrt_lock_lock (&mail_map_lock);
+ gpgol_lock (&mail_map_lock);
auto mail_map_copy = s_mail_map;
- gpgrt_lock_unlock (&mail_map_lock);
+ gpgol_unlock (&mail_map_lock);
for (it = mail_map_copy.begin(); it != mail_map_copy.end(); ++it)
{
if (it->second->wipe_o ())
@@ -2361,9 +2361,9 @@ Mail::setUUID_o ()
delete other;
}
- gpgrt_lock_lock (&uid_map_lock);
+ gpgol_lock (&uid_map_lock);
s_uid_map.insert (std::pair<std::string, Mail *> (m_uuid, this));
- gpgrt_lock_unlock (&uid_map_lock);
+ gpgol_unlock (&uid_map_lock);
log_debug ("%s:%s: uuid for %p is now %s",
SRCNAME, __func__, this,
m_uuid.c_str());
@@ -3330,10 +3330,10 @@ void
Mail::locateAllCryptoRecipients_o ()
{
TSTART;
- gpgrt_lock_lock (&mail_map_lock);
+ gpgol_lock (&mail_map_lock);
std::map<LPDISPATCH, Mail *>::iterator it;
auto mail_map_copy = s_mail_map;
- gpgrt_lock_unlock (&mail_map_lock);
+ gpgol_unlock (&mail_map_lock);
for (it = mail_map_copy.begin(); it != mail_map_copy.end(); ++it)
{
if (it->second->needs_crypto_m ())
diff --git a/src/parsecontroller.cpp b/src/parsecontroller.cpp
index b6428bc..84a7592 100644
--- a/src/parsecontroller.cpp
+++ b/src/parsecontroller.cpp
@@ -626,10 +626,10 @@ ParseController::get_ultimate_keys()
TSTART;
static bool s_keys_listed;
static std::vector<Key> s_ultimate_keys;
- gpgrt_lock_lock (&keylist_lock);
+ gpgol_lock (&keylist_lock);
if (s_keys_listed)
{
- gpgrt_lock_unlock (&keylist_lock);
+ gpgol_unlock (&keylist_lock);
TRETURN s_ultimate_keys;
}
log_debug ("%s:%s: Starting keylisting.",
@@ -640,7 +640,7 @@ ParseController::get_ultimate_keys()
/* Maybe PGP broken and not S/MIME */
log_error ("%s:%s: broken installation no ctx.",
SRCNAME, __func__);
- gpgrt_lock_unlock (&keylist_lock);
+ gpgol_unlock (&keylist_lock);
TRETURN s_ultimate_keys;
}
ctx->setKeyListMode (KeyListMode::Local);
@@ -650,7 +650,7 @@ ParseController::get_ultimate_keys()
{
log_error ("%s:%s: Failed to start keylisting err: %i: %s",
SRCNAME, __func__, err.code (), err.asString());
- gpgrt_lock_unlock (&keylist_lock);
+ gpgol_unlock (&keylist_lock);
TRETURN s_ultimate_keys;
}
TRACEPOINT;
@@ -687,6 +687,6 @@ ParseController::get_ultimate_keys()
SRCNAME, __func__);
s_keys_listed = true;
- gpgrt_lock_unlock (&keylist_lock);
+ gpgol_unlock (&keylist_lock);
TRETURN s_ultimate_keys;
}
diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp
index 0b233e9..e269d0a 100644
--- a/src/windowmessages.cpp
+++ b/src/windowmessages.cpp
@@ -510,7 +510,7 @@ delayed_invalidate_ui (LPVOID minsleep)
}
TRACEPOINT;
invalidation_in_progress = true;
- gpgrt_lock_lock(&invalidate_lock);
+ gpgol_lock(&invalidate_lock);
int sleep_ms = (intptr_t)minsleep;
Sleep (sleep_ms);
@@ -530,7 +530,7 @@ delayed_invalidate_ui (LPVOID minsleep)
do_in_ui_thread (INVALIDATE_UI, nullptr);
TRACEPOINT;
invalidation_in_progress = false;
- gpgrt_lock_unlock(&invalidate_lock);
+ gpgol_unlock(&invalidate_lock);
TRETURN 0;
}
diff --git a/src/wks-helper.cpp b/src/wks-helper.cpp
index acf79e3..96cc23e 100644
--- a/src/wks-helper.cpp
+++ b/src/wks-helper.cpp
@@ -60,8 +60,8 @@ WKSHelper::~WKSHelper ()
{
// Ensure that we are not destroyed while
// worker is running.
- gpgrt_lock_lock (&wks_lock);
- gpgrt_lock_unlock (&wks_lock);
+ gpgol_lock (&wks_lock);
+ gpgol_unlock (&wks_lock);
}
const WKSHelper*
@@ -77,10 +77,10 @@ WKSHelper::instance ()
WKSHelper::WKSState
WKSHelper::get_state (const std::string &mbox) const
{
- gpgrt_lock_lock (&wks_lock);
+ gpgol_lock (&wks_lock);
const auto it = s_states.find(mbox);
const auto dataEnd = s_states.end();
- gpgrt_lock_unlock (&wks_lock);
+ gpgol_unlock (&wks_lock);
if (it == dataEnd)
{
return NotChecked;
@@ -91,10 +91,10 @@ WKSHelper::get_state (const std::string &mbox) const
time_t
WKSHelper::get_check_time (const std::string &mbox) const
{
- gpgrt_lock_lock (&wks_lock);
+ gpgol_lock (&wks_lock);
const auto it = s_last_checked.find(mbox);
const auto dataEnd = s_last_checked.end();
- gpgrt_lock_unlock (&wks_lock);
+ gpgol_unlock (&wks_lock);
if (it == dataEnd)
{
return 0;
@@ -105,18 +105,18 @@ WKSHelper::get_check_time (const std::string &mbox) const
std::pair <GpgME::Data *, Mail *>
WKSHelper::get_cached_confirmation (const std::string &mbox) const
{
- gpgrt_lock_lock (&wks_lock);
+ gpgol_lock (&wks_lock);
const auto it = s_confirmation_cache.find(mbox);
const auto dataEnd = s_confirmation_cache.end();
if (it == dataEnd)
{
- gpgrt_lock_unlock (&wks_lock);
+ gpgol_unlock (&wks_lock);
return std::make_pair (nullptr, nullptr);
}
auto ret = it->second;
s_confirmation_cache.erase (it);
- gpgrt_lock_unlock (&wks_lock);
+ gpgol_unlock (&wks_lock);
return ret;
}
@@ -339,7 +339,7 @@ WKSHelper::load () const
void
WKSHelper::save () const
{
- gpgrt_lock_lock (&wks_lock);
+ gpgol_lock (&wks_lock);
for (const auto &pair: s_states)
{
auto state = std::to_string (pair.second) + ';';
@@ -360,7 +360,7 @@ WKSHelper::save () const
SRCNAME, __func__);
}
}
- gpgrt_lock_unlock (&wks_lock);
+ gpgol_unlock (&wks_lock);
}
static DWORD WINAPI
@@ -379,7 +379,7 @@ do_notify (LPVOID arg)
void
WKSHelper::allow_notify (int sleepTimeMS) const
{
- gpgrt_lock_lock (&wks_lock);
+ gpgol_lock (&wks_lock);
for (auto &pair: s_states)
{
if (pair.second == ConfirmationSeen ||
@@ -393,7 +393,7 @@ WKSHelper::allow_notify (int sleepTimeMS) const
break;
}
}
- gpgrt_lock_unlock (&wks_lock);
+ gpgol_unlock (&wks_lock);
}
void
@@ -523,7 +523,7 @@ void
WKSHelper::update_state (const std::string &mbox, WKSState state,
bool store) const
{
- gpgrt_lock_lock (&wks_lock);
+ gpgol_lock (&wks_lock);
auto it = s_states.find(mbox);
if (it != s_states.end())
@@ -534,7 +534,7 @@ WKSHelper::update_state (const std::string &mbox, WKSState state,
{
s_states.insert (std::make_pair (mbox, state));
}
- gpgrt_lock_unlock (&wks_lock);
+ gpgol_unlock (&wks_lock);
if (store)
{
@@ -546,7 +546,7 @@ void
WKSHelper::update_last_checked (const std::string &mbox, time_t time,
bool store) const
{
- gpgrt_lock_lock (&wks_lock);
+ gpgol_lock (&wks_lock);
auto it = s_last_checked.find(mbox);
if (it != s_last_checked.end())
{
@@ -556,7 +556,7 @@ WKSHelper::update_last_checked (const std::string &mbox, time_t time,
{
s_last_checked.insert (std::make_pair (mbox, time));
}
- gpgrt_lock_unlock (&wks_lock);
+ gpgol_unlock (&wks_lock);
if (store)
{
@@ -837,9 +837,9 @@ WKSHelper::handle_confirmation_read (Mail *mail, LPSTREAM stream) const
/* And reset it to start */
mystdin->seek (0, SEEK_SET);
- gpgrt_lock_lock (&wks_lock);
+ gpgol_lock (&wks_lock);
s_confirmation_cache.insert (std::make_pair (mbox, std::make_pair (mystdin, mail)));
- gpgrt_lock_unlock (&wks_lock);
+ gpgol_unlock (&wks_lock);
update_state (mbox, ConfirmationSeen);
-----------------------------------------------------------------------
Summary of changes:
src/debug.cpp | 4 +-
src/debug.h | 22 +++++++++++
src/dispcache.cpp | 16 ++++----
src/explorer-events.cpp | 16 ++++----
src/keycache.cpp | 102 ++++++++++++++++++++++++------------------------
src/mail.cpp | 88 ++++++++++++++++++++---------------------
src/parsecontroller.cpp | 10 ++---
src/windowmessages.cpp | 4 +-
src/wks-helper.cpp | 38 +++++++++---------
9 files changed, 161 insertions(+), 139 deletions(-)
hooks/post-receive
--
GnuPG extension for MS Outlook
http://git.gnupg.org
More information about the Gnupg-commits
mailing list