mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
Fix panic with very large ListView
In `ItemRc::find_sibling` we currently do: 1. get the range 2. check that the next index is within the range 3. call `get_subtree` The problem is that get_subtree itselg will call 'ensure_updated' which will do the relayout of the ListView and may get a different range of element. So don't query the range before and just have get_subtree to return an empty ItemWeak if we are out of the actual range. Couldn't really find a way to make a test since this is called from the accessibility code which is hard to test as is For #3700
This commit is contained in:
parent
b8c3bbef74
commit
5bf2c7192b
5 changed files with 38 additions and 31 deletions
|
@ -1208,8 +1208,11 @@ public:
|
|||
return { &C::static_vtable, const_cast<C *>(&(**x.ptr)) };
|
||||
}
|
||||
|
||||
vtable::VWeak<private_api::ItemTreeVTable> instance_at(int i) const
|
||||
vtable::VWeak<private_api::ItemTreeVTable> instance_at(std::size_t i) const
|
||||
{
|
||||
if (i >= inner->data.size()) {
|
||||
return {};
|
||||
}
|
||||
const auto &x = inner->data.at(i);
|
||||
return vtable::VWeak<private_api::ItemTreeVTable> { x.ptr->into_dyn() };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue