From 04001d7b092090571c0d11c686ee8d241b5cd89c Mon Sep 17 00:00:00 2001 From: chaoticgd <43898262+chaoticgd@users.noreply.github.com> Date: Sun, 10 Mar 2024 11:30:27 +0000 Subject: [PATCH] Debugger: Fix beginInsertRows/endInsertRows calls in symbol tree model Previously it was checking the element count on a moved-from object. --- pcsx2-qt/Debugger/SymbolTree/SymbolTreeModel.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pcsx2-qt/Debugger/SymbolTree/SymbolTreeModel.cpp b/pcsx2-qt/Debugger/SymbolTree/SymbolTreeModel.cpp index 051dfdd25f402..b31292e39bdef 100644 --- a/pcsx2-qt/Debugger/SymbolTree/SymbolTreeModel.cpp +++ b/pcsx2-qt/Debugger/SymbolTree/SymbolTreeModel.cpp @@ -205,6 +205,9 @@ void SymbolTreeModel::fetchMore(const QModelIndex& parent) if (!parent_node || !parent_node->type.valid()) return; + if (!parent_node->children().empty()) + return; + std::vector> children; m_guardian.TryRead([&](const ccc::SymbolDatabase& database) -> void { const ccc::ast::Node* logical_parent_type = parent_node->type.lookup_node(database); @@ -215,10 +218,11 @@ void SymbolTreeModel::fetchMore(const QModelIndex& parent) parent_node->name, parent_node->location, *logical_parent_type, parent_node->type, m_cpu, database); }); - if (!children.empty()) + bool insert_children = !children.empty(); + if (insert_children) beginInsertRows(parent, 0, children.size() - 1); parent_node->setChildren(std::move(children)); - if (!children.empty()) + if (insert_children) endInsertRows(); }