Closed heng30 closed 1 year ago
Do you have a small example to reproduce this?
How do you try to update the model?
You seem to be using the Qt backend, but which OS do you run on?
I use archlinux.
I don't have a small example. This issue produce after i update three listview models, it produce randomly and hard to reproduce.
you can find the source code in https://github.com/Heng30/chatbox/blob/main/chatbox/src/logic/session.rs, when execute the ui.global::<Logic>().on_switch_session()
function, the program has a low probability crash. I think the issue caused by ui.global::<Logic>().invoke_show_session_archive_list(new_uuid.clone());
or maybe not.
I generate a new model and replace the old one to update the model.
If I push the ui.global::<Logic>().invoke_show_session_archive_list(new_uuid.clone());
in a timer to update the model after delay. The issue seem to be fixed.
I cloned your code and try to reproduce it, but I don't know how to reproduce it since i don't know what to do to make it crash (and not speaking the language doesn't help)
Anyway, the unwrap occurs when accessing the model in this line:
c.1.as_ref().unwrap().update(new_offset, model.row_data(new_offset).unwrap());
Presumably the second unwrap is falling because the model return None. Either we do something wrong and new_offset is somehow outside of the range, or something else fishy is going on.
I'll try to make it a better error message
Actually, I was able to reproduce it In a testcase. Thanks for reporting.
https://github.com/slint-ui/slint/pull/2822 should be fixing the issue. You can try using the git version of slint for now and see if it fixes it
When I update Listview model datas, the program crash. Here is the Rust backtrace: