HackStudio: Store correct address in ClassViewModel's ModelIndices

When 359d6e7b0b happened, the return value
of `children[row]` went from being `ClassViewNode&` to
`NonnullOwnPtr<ClassViewNode>&`, so we were putting the wrong address
into the ModelIndex's data.
This commit is contained in:
Sam Atkins 2023-03-08 20:51:25 +00:00 committed by Andreas Kling
parent 1393ed2000
commit 24d5bf8173
Notes: sideshowbarker 2024-07-16 23:10:13 +09:00

View file

@ -91,9 +91,9 @@ GUI::ModelIndex ClassViewModel::parent_index(const GUI::ModelIndex& index) const
GUI::ModelIndex ClassViewModel::index(int row, int column, const GUI::ModelIndex& parent_index) const
{
if (!parent_index.is_valid())
return create_index(row, column, &m_root_scope[row]);
return create_index(row, column, m_root_scope[row].ptr());
auto* parent = static_cast<ClassViewNode const*>(parent_index.internal_data());
auto* child = &parent->children[row];
auto* child = parent->children[row].ptr();
return create_index(row, column, child);
}