diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-11-27 17:13:55 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-11-27 17:13:55 +0100 |
commit | 6ed11b0078a7e1f1514e2d31e015f936f2c14b64 (patch) | |
tree | 56bebc66bff39629ce8bcebab8780982f76255d2 /framework/src | |
parent | d53187b2975b66c21384fc271f6ce2d878bec91b (diff) | |
download | kube-6ed11b0078a7e1f1514e2d31e015f936f2c14b64.tar.gz kube-6ed11b0078a7e1f1514e2d31e015f936f2c14b64.zip |
It's unclear how thread-safe the constructor/protocol access is,
so let's guard it.
Diffstat (limited to 'framework/src')
-rw-r--r-- | framework/src/domain/mime/mailcrypto.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/framework/src/domain/mime/mailcrypto.cpp b/framework/src/domain/mime/mailcrypto.cpp index 8cf55089..a4723199 100644 --- a/framework/src/domain/mime/mailcrypto.cpp +++ b/framework/src/domain/mime/mailcrypto.cpp | |||
@@ -32,6 +32,8 @@ | |||
32 | #include <gpgme++/keylistresult.h> | 32 | #include <gpgme++/keylistresult.h> |
33 | #include <gpgme++/importresult.h> | 33 | #include <gpgme++/importresult.h> |
34 | #include <QDebug> | 34 | #include <QDebug> |
35 | #include <QMutex> | ||
36 | #include <QMutexLocker> | ||
35 | 37 | ||
36 | /* | 38 | /* |
37 | * FIXME: | 39 | * FIXME: |
@@ -471,12 +473,16 @@ void MailCrypto::importKeys(const std::vector<GpgME::Key> &keys) | |||
471 | job->exec(keys); | 473 | job->exec(keys); |
472 | } | 474 | } |
473 | 475 | ||
476 | QMutex sMutex; | ||
477 | |||
474 | std::vector<GpgME::Key> MailCrypto::findKeys(const QStringList &filter, bool findPrivate, bool remote, Protocol protocol) | 478 | std::vector<GpgME::Key> MailCrypto::findKeys(const QStringList &filter, bool findPrivate, bool remote, Protocol protocol) |
475 | { | 479 | { |
480 | QMutexLocker locker{&sMutex}; | ||
476 | const QGpgME::Protocol *const backend = protocol == SMIME ? QGpgME::smime() : QGpgME::openpgp(); | 481 | const QGpgME::Protocol *const backend = protocol == SMIME ? QGpgME::smime() : QGpgME::openpgp(); |
477 | Q_ASSERT(backend); | 482 | Q_ASSERT(backend); |
478 | QGpgME::KeyListJob *job = backend->keyListJob(remote); | 483 | QGpgME::KeyListJob *job = backend->keyListJob(remote); |
479 | Q_ASSERT(job); | 484 | Q_ASSERT(job); |
485 | locker.unlock(); | ||
480 | 486 | ||
481 | std::vector<GpgME::Key> keys; | 487 | std::vector<GpgME::Key> keys; |
482 | GpgME::KeyListResult res = job->exec(filter, findPrivate, keys); | 488 | GpgME::KeyListResult res = job->exec(filter, findPrivate, keys); |