summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--framework/src/domain/mime/mailcrypto.cpp6
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
476QMutex sMutex;
477
474std::vector<GpgME::Key> MailCrypto::findKeys(const QStringList &filter, bool findPrivate, bool remote, Protocol protocol) 478std::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);