diff options
Diffstat (limited to 'src/core/model')
-rw-r--r-- | src/core/model/DataObject.h | 6 | ||||
-rw-r--r-- | src/core/model/GpgDecryptResult.cpp | 2 | ||||
-rw-r--r-- | src/core/model/GpgDecryptResult.h | 2 | ||||
-rw-r--r-- | src/core/model/GpgEncryptResult.cpp | 2 | ||||
-rw-r--r-- | src/core/model/GpgEncryptResult.h | 2 | ||||
-rw-r--r-- | src/core/model/GpgGenerateKeyResult.cpp | 2 | ||||
-rw-r--r-- | src/core/model/GpgGenerateKeyResult.h | 3 | ||||
-rw-r--r-- | src/core/model/GpgKeyTreeModel.cpp | 11 | ||||
-rw-r--r-- | src/core/model/GpgSignResult.cpp | 2 | ||||
-rw-r--r-- | src/core/model/GpgSignResult.h | 2 | ||||
-rw-r--r-- | src/core/model/GpgVerifyResult.cpp | 2 | ||||
-rw-r--r-- | src/core/model/GpgVerifyResult.h | 2 |
12 files changed, 22 insertions, 16 deletions
diff --git a/src/core/model/DataObject.h b/src/core/model/DataObject.h index efd75c16..ea8fc4c4 100644 --- a/src/core/model/DataObject.h +++ b/src/core/model/DataObject.h @@ -80,13 +80,13 @@ class GPGFRONTEND_CORE_EXPORT DataObject { }; template <typename... Args> -auto TransferParams(Args&&... args) -> std::shared_ptr<DataObject> { +auto TransferParams(Args&&... args) -> QSharedPointer<DataObject> { return GpgFrontend::SecureCreateSharedObject<DataObject>( DataObject{std::forward<Args>(args)...}); } template <typename T> -auto ExtractParams(const std::shared_ptr<DataObject>& d_o, int index) -> T { +auto ExtractParams(const QSharedPointer<DataObject>& d_o, int index) -> T { if (!d_o) { throw std::invalid_argument("nullptr provided for DataObjectPtr"); } @@ -95,7 +95,7 @@ auto ExtractParams(const std::shared_ptr<DataObject>& d_o, int index) -> T { void swap(DataObject& a, DataObject& b) noexcept; -using DataObjectPtr = std::shared_ptr<DataObject>; ///< +using DataObjectPtr = QSharedPointer<DataObject>; ///< using OperaRunnable = std::function<GFError(DataObjectPtr)>; using OperationCallback = std::function<void(GFError, DataObjectPtr)>; diff --git a/src/core/model/GpgDecryptResult.cpp b/src/core/model/GpgDecryptResult.cpp index a2e2c9a7..bcfbe908 100644 --- a/src/core/model/GpgDecryptResult.cpp +++ b/src/core/model/GpgDecryptResult.cpp @@ -31,7 +31,7 @@ namespace GpgFrontend { GpgDecryptResult::GpgDecryptResult(gpgme_decrypt_result_t r) - : result_ref_(std::shared_ptr<struct _gpgme_op_decrypt_result>( + : result_ref_(QSharedPointer<struct _gpgme_op_decrypt_result>( (gpgme_result_ref(r), r), [](gpgme_decrypt_result_t p) { if (p != nullptr) { gpgme_result_unref(p); diff --git a/src/core/model/GpgDecryptResult.h b/src/core/model/GpgDecryptResult.h index 1b755868..772b24cb 100644 --- a/src/core/model/GpgDecryptResult.h +++ b/src/core/model/GpgDecryptResult.h @@ -48,7 +48,7 @@ class GPGFRONTEND_CORE_EXPORT GpgDecryptResult { virtual ~GpgDecryptResult(); private: - std::shared_ptr<struct _gpgme_op_decrypt_result> result_ref_ = nullptr; ///< + QSharedPointer<struct _gpgme_op_decrypt_result> result_ref_ = nullptr; ///< }; } // namespace GpgFrontend
\ No newline at end of file diff --git a/src/core/model/GpgEncryptResult.cpp b/src/core/model/GpgEncryptResult.cpp index 69a8535a..a3a29fcc 100644 --- a/src/core/model/GpgEncryptResult.cpp +++ b/src/core/model/GpgEncryptResult.cpp @@ -30,7 +30,7 @@ namespace GpgFrontend { GpgEncryptResult::GpgEncryptResult(gpgme_encrypt_result_t r) - : result_ref_(std::shared_ptr<struct _gpgme_op_encrypt_result>( + : result_ref_(QSharedPointer<struct _gpgme_op_encrypt_result>( (gpgme_result_ref(r), r), [](gpgme_encrypt_result_t p) { if (p != nullptr) { gpgme_result_unref(p); diff --git a/src/core/model/GpgEncryptResult.h b/src/core/model/GpgEncryptResult.h index 97a52a03..9167f28d 100644 --- a/src/core/model/GpgEncryptResult.h +++ b/src/core/model/GpgEncryptResult.h @@ -47,7 +47,7 @@ class GPGFRONTEND_CORE_EXPORT GpgEncryptResult { virtual ~GpgEncryptResult(); private: - std::shared_ptr<struct _gpgme_op_encrypt_result> result_ref_ = nullptr; ///< + QSharedPointer<struct _gpgme_op_encrypt_result> result_ref_ = nullptr; ///< }; } // namespace GpgFrontend
\ No newline at end of file diff --git a/src/core/model/GpgGenerateKeyResult.cpp b/src/core/model/GpgGenerateKeyResult.cpp index 2b455a22..928321c7 100644 --- a/src/core/model/GpgGenerateKeyResult.cpp +++ b/src/core/model/GpgGenerateKeyResult.cpp @@ -33,7 +33,7 @@ namespace GpgFrontend { GpgGenerateKeyResult::GpgGenerateKeyResult(gpgme_genkey_result_t r) - : result_ref_(std::shared_ptr<struct _gpgme_op_genkey_result>( + : result_ref_(QSharedPointer<struct _gpgme_op_genkey_result>( (gpgme_result_ref(r), r), [](gpgme_genkey_result_t p) { if (p != nullptr) { gpgme_result_unref(p); diff --git a/src/core/model/GpgGenerateKeyResult.h b/src/core/model/GpgGenerateKeyResult.h index ac5d6b05..80e49a38 100644 --- a/src/core/model/GpgGenerateKeyResult.h +++ b/src/core/model/GpgGenerateKeyResult.h @@ -52,8 +52,7 @@ class GPGFRONTEND_CORE_EXPORT GpgGenerateKeyResult { virtual ~GpgGenerateKeyResult(); private: - using ResultRefHandler = - std::shared_ptr<struct _gpgme_op_genkey_result>; ///< + using ResultRefHandler = QSharedPointer<struct _gpgme_op_genkey_result>; ///< ResultRefHandler result_ref_ = nullptr; ///< }; diff --git a/src/core/model/GpgKeyTreeModel.cpp b/src/core/model/GpgKeyTreeModel.cpp index 92a0f77c..f521e8c9 100644 --- a/src/core/model/GpgKeyTreeModel.cpp +++ b/src/core/model/GpgKeyTreeModel.cpp @@ -218,6 +218,7 @@ auto GpgKeyTreeModel::create_gpg_key_tree_items(const GpgAbstractKeyPtr &key) columns << g_key->Algo(); columns << QLocale().toString(g_key->CreationTime(), "yyyy-MM-dd"); + assert(key != nullptr); auto i_key = QSharedPointer<GpgKeyTreeItem>::create(key, columns); i_key->SetEnable(true); i_key->SetCheckable(checkable_detector_(i_key->Key())); @@ -317,9 +318,15 @@ void GpgKeyTreeItem::SetChecked(bool checked) { checked_ = checked; } void GpgKeyTreeItem::SetCheckable(bool checkable) { checkable_ = checkable; } -auto GpgKeyTreeItem::Key() const -> GpgAbstractKey * { return key_.get(); } +auto GpgKeyTreeItem::Key() const -> GpgAbstractKey * { + assert(key_ != nullptr); + return key_.get(); +} -auto GpgKeyTreeItem::SharedKey() const -> GpgAbstractKeyPtr { return key_; } +auto GpgKeyTreeItem::SharedKey() const -> GpgAbstractKeyPtr { + assert(key_ != nullptr); + return key_; +} auto GpgKeyTreeItem::Enable() const -> bool { return enable_; } diff --git a/src/core/model/GpgSignResult.cpp b/src/core/model/GpgSignResult.cpp index 8227d46e..6428a461 100644 --- a/src/core/model/GpgSignResult.cpp +++ b/src/core/model/GpgSignResult.cpp @@ -29,7 +29,7 @@ #include "GpgSignResult.h" namespace GpgFrontend { GpgSignResult::GpgSignResult(gpgme_sign_result_t r) - : result_ref_(std::shared_ptr<struct _gpgme_op_sign_result>( + : result_ref_(QSharedPointer<struct _gpgme_op_sign_result>( (gpgme_result_ref(r), r), [](gpgme_sign_result_t p) { if (p != nullptr) { gpgme_result_unref(p); diff --git a/src/core/model/GpgSignResult.h b/src/core/model/GpgSignResult.h index 75f106f6..434a590e 100644 --- a/src/core/model/GpgSignResult.h +++ b/src/core/model/GpgSignResult.h @@ -50,6 +50,6 @@ class GPGFRONTEND_CORE_EXPORT GpgSignResult { virtual ~GpgSignResult(); private: - std::shared_ptr<struct _gpgme_op_sign_result> result_ref_ = nullptr; ///< + QSharedPointer<struct _gpgme_op_sign_result> result_ref_ = nullptr; ///< }; } // namespace GpgFrontend
\ No newline at end of file diff --git a/src/core/model/GpgVerifyResult.cpp b/src/core/model/GpgVerifyResult.cpp index ca5784d8..aab23028 100644 --- a/src/core/model/GpgVerifyResult.cpp +++ b/src/core/model/GpgVerifyResult.cpp @@ -32,7 +32,7 @@ namespace GpgFrontend { GpgVerifyResult::GpgVerifyResult(gpgme_verify_result_t r) - : result_ref_(std::shared_ptr<struct _gpgme_op_verify_result>( + : result_ref_(QSharedPointer<struct _gpgme_op_verify_result>( (gpgme_result_ref(r), r), [](gpgme_verify_result_t p) { if (p != nullptr) { gpgme_result_unref(p); diff --git a/src/core/model/GpgVerifyResult.h b/src/core/model/GpgVerifyResult.h index 6e61497e..b928d2ca 100644 --- a/src/core/model/GpgVerifyResult.h +++ b/src/core/model/GpgVerifyResult.h @@ -48,6 +48,6 @@ class GPGFRONTEND_CORE_EXPORT GpgVerifyResult { virtual ~GpgVerifyResult(); private: - std::shared_ptr<struct _gpgme_op_verify_result> result_ref_ = nullptr; ///< + QSharedPointer<struct _gpgme_op_verify_result> result_ref_ = nullptr; ///< }; } // namespace GpgFrontend
\ No newline at end of file |