aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/model/GpgKey.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2022-12-22 10:30:36 +0000
committerSaturneric <[email protected]>2022-12-22 10:30:36 +0000
commit3cb623b07e50d9e95dace9966dc0337e72f57dc2 (patch)
treedfe994f28f0a6dee6151febf3b50f22adceab74e /src/core/model/GpgKey.cpp
parentMerge pull request #70 from saturneric/dev/2.0.8/saturneric (diff)
parentfix: continue to solve ubuntu 18.04 build issues (diff)
downloadGpgFrontend-2.0.10.tar.gz
GpgFrontend-2.0.10.zip
fix: solve conflictsv2.0.10
Diffstat (limited to '')
-rw-r--r--src/core/model/GpgKey.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/model/GpgKey.cpp b/src/core/model/GpgKey.cpp
index ad88a649..4716d9cc 100644
--- a/src/core/model/GpgKey.cpp
+++ b/src/core/model/GpgKey.cpp
@@ -28,6 +28,8 @@
#include "core/model/GpgKey.h"
+#include <mutex>
+
GpgFrontend::GpgKey::GpgKey(gpgme_key_t &&key) : key_ref_(std::move(key)) {}
GpgFrontend::GpgKey::GpgKey(GpgKey &&k) noexcept { swap(key_ref_, k.key_ref_); }
@@ -225,7 +227,10 @@ bool GpgFrontend::GpgKey::IsHasActualEncryptionCapability() const {
}
GpgFrontend::GpgKey GpgFrontend::GpgKey::Copy() const {
- gpgme_key_ref(key_ref_.get());
+ {
+ const std::lock_guard<std::mutex> guard(gpgme_key_opera_mutex);
+ gpgme_key_ref(key_ref_.get());
+ }
auto *_new_key_ref = key_ref_.get();
return GpgKey(std::move(_new_key_ref));
}