Skip to content

Commit

Permalink
Debugger: Fix beginInsertRows/endInsertRows calls in symbol tree model
Browse files Browse the repository at this point in the history
Previously it was checking the element count on a moved-from object.
  • Loading branch information
chaoticgd committed Mar 10, 2024
1 parent 1a10970 commit 04001d7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pcsx2-qt/Debugger/SymbolTree/SymbolTreeModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::unique_ptr<SymbolTreeNode>> children;
m_guardian.TryRead([&](const ccc::SymbolDatabase& database) -> void {
const ccc::ast::Node* logical_parent_type = parent_node->type.lookup_node(database);
Expand All @@ -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();
}

Expand Down

0 comments on commit 04001d7

Please sign in to comment.