aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/model/GpgKey.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/model/GpgKey.cpp')
-rw-r--r--src/core/model/GpgKey.cpp24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/core/model/GpgKey.cpp b/src/core/model/GpgKey.cpp
index 8a7f5a6e..9e6df32b 100644
--- a/src/core/model/GpgKey.cpp
+++ b/src/core/model/GpgKey.cpp
@@ -41,13 +41,13 @@ auto GpgKey::operator=(GpgKey &&k) noexcept -> GpgKey & {
return *this;
}
-GpgKey::GpgKey(const GpgKey &key) noexcept {
+GpgKey::GpgKey(const GpgKey &key) {
+ auto *key_ref = key.key_ref_.get();
{
const std::lock_guard<std::mutex> guard(gpgme_key_opera_mutex_);
- gpgme_key_ref(key.key_ref_.get());
+ gpgme_key_ref(key_ref);
}
- auto *new_key_ref = key_ref_.get();
- this->key_ref_ = KeyRefHandler(std::move(new_key_ref));
+ this->key_ref_ = KeyRefHandler(key_ref);
}
auto GpgKey::operator=(const GpgKey &key) -> GpgKey & {
@@ -55,13 +55,12 @@ auto GpgKey::operator=(const GpgKey &key) -> GpgKey & {
return *this;
}
+ auto *key_ref = key.key_ref_.get();
{
const std::lock_guard<std::mutex> guard(gpgme_key_opera_mutex_);
- gpgme_key_ref(key.key_ref_.get());
+ gpgme_key_ref(key_ref);
}
- auto *new_key_ref = key_ref_.get();
- this->key_ref_ = KeyRefHandler(std::move(new_key_ref));
-
+ this->key_ref_ = KeyRefHandler(key_ref);
return *this;
}
@@ -248,15 +247,6 @@ auto GpgKey::IsHasActualEncryptionCapability() const -> bool {
});
}
-auto GpgKey::Copy() const -> GpgKey {
- {
- 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));
-}
-
void GpgKey::KeyRefDeleter::operator()(gpgme_key_t _key) {
if (_key != nullptr) gpgme_key_unref(_key);
}