diff options
author | saturneric <[email protected]> | 2024-07-27 08:56:19 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-07-27 08:56:19 +0000 |
commit | 1c4445408577a3bd5743d344cdd31f21d81dc9c0 (patch) | |
tree | 18deeb8cac0c66f831c4dd0f9600487c4855cbdf /src/core/module/GlobalRegisterTable.cpp | |
parent | fix: indirect memory leak issues (diff) | |
download | GpgFrontend-1c4445408577a3bd5743d344cdd31f21d81dc9c0.tar.gz GpgFrontend-1c4445408577a3bd5743d344cdd31f21d81dc9c0.zip |
fix: discover and solve some memory issues
Diffstat (limited to 'src/core/module/GlobalRegisterTable.cpp')
-rw-r--r-- | src/core/module/GlobalRegisterTable.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/core/module/GlobalRegisterTable.cpp b/src/core/module/GlobalRegisterTable.cpp index bac51d85..c19a9131 100644 --- a/src/core/module/GlobalRegisterTable.cpp +++ b/src/core/module/GlobalRegisterTable.cpp @@ -126,8 +126,8 @@ class GlobalRegisterTable::Impl { return rtn; } - auto ListenPublish(QObject* o, const Namespace& n, const Key& k, LPCallback c) - -> bool { + auto ListenPublish(QObject* o, const Namespace& n, const Key& k, + LPCallback c) -> bool { if (o == nullptr) return false; return QObject::connect(parent_, &GlobalRegisterTable::SignalPublish, o, [n, k, c](const Namespace& pn, const Key& pk, @@ -138,7 +138,7 @@ class GlobalRegisterTable::Impl { }) == nullptr; } - auto RootRTNode() -> RTNode* { return root_node_.get(); } + auto RootRTNode() -> RTNodePtr { return root_node_; } private: std::shared_mutex lock_; @@ -165,8 +165,8 @@ class GlobalRegisterTableTreeModel::Impl { return 4; } - [[nodiscard]] auto Data(const QModelIndex& index, int role) const - -> QVariant { + [[nodiscard]] auto Data(const QModelIndex& index, + int role) const -> QVariant { if (!index.isValid()) return {}; if (role == Qt::DisplayRole) { @@ -232,8 +232,8 @@ class GlobalRegisterTableTreeModel::Impl { return tr("<UNSUPPORTED>"); } - [[nodiscard]] auto Index(int row, int column, const QModelIndex& parent) const - -> QModelIndex { + [[nodiscard]] auto Index(int row, int column, + const QModelIndex& parent) const -> QModelIndex { if (!parent_->hasIndex(row, column, parent)) return {}; auto* parent_node = !parent.isValid() @@ -292,8 +292,8 @@ auto GlobalRegisterTable::PublishKV(Namespace n, Key k, std::any v) -> bool { return p_->PublishKV(n, k, v); } -auto GlobalRegisterTable::LookupKV(Namespace n, Key v) - -> std::optional<std::any> { +auto GlobalRegisterTable::LookupKV(Namespace n, + Key v) -> std::optional<std::any> { return p_->LookupKV(n, v); } @@ -302,14 +302,15 @@ auto GlobalRegisterTable::ListenPublish(QObject* o, Namespace n, Key k, return p_->ListenPublish(o, n, k, c); } -auto GlobalRegisterTable::ListChildKeys(Namespace n, Key k) - -> std::vector<Key> { +auto GlobalRegisterTable::ListChildKeys(Namespace n, + Key k) -> std::vector<Key> { return p_->ListChildKeys(n, k); } GlobalRegisterTableTreeModel::GlobalRegisterTableTreeModel( - GlobalRegisterTable* grt) - : p_(SecureCreateUniqueObject<Impl>(this, grt->p_.get())) {} + GlobalRegisterTable* grt, QObject* parent) + : QAbstractItemModel(parent), + p_(SecureCreateUniqueObject<Impl>(this, grt->p_.get())) {} auto GlobalRegisterTableTreeModel::rowCount(const QModelIndex& parent) const -> int { @@ -326,9 +327,8 @@ auto GlobalRegisterTableTreeModel::data(const QModelIndex& index, return p_->Data(index, role); } -auto GlobalRegisterTableTreeModel::index(int row, int column, - const QModelIndex& parent) const - -> QModelIndex { +auto GlobalRegisterTableTreeModel::index( + int row, int column, const QModelIndex& parent) const -> QModelIndex { return p_->Index(row, column, parent); } |