-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upgrade_in_event_loop not always processed #5699
Comments
We do store the event on a queue, then we wake the thread and process these events. This is what happens when posting an event: slint/internal/backends/android-activity/lib.rs Lines 180 to 181 in 9b7397f
And this is where we process them. slint/internal/backends/android-activity/androidwindowadapter.rs Lines 198 to 200 in 9b7397f
I was able to reproduce the bug with your testcase, and added logs in the android-activity backend confirm that we do call AndroidAppWaker::wake , but the PollEvent::Wake is not received. What I could do is to process the pending even from the queue as long as the event loops wakes up (regardless of the event, even if it's not PollEvent::Wake), this would mean than any other touch or timeout would result in the event being processed. But I don't know why we don't get an PollEvent::Wake |
Workaround in #5729 |
Thanks for merging the workaround! How about keeping this ticket open until a real solution is found? Even if you're not actively looking at this, it's worth remembering that the problem exists. |
Slint 1.7 + Rust
Android
I noticed that the code provided to the
upgrade_in_event_loop
is not always processed. So far, I have only been able to reproduce the issue on Android, and it happens only occasionally.Minimal example:
Slint code
Rust code
Log output
Explanation:
When we click a "Process" button, a callback is invoked, handled on the Rust side. In the callback, we spawn an async task that sleeps for some time. Before the processing request is invoked, an overlay (busy screen) is displayed in the UI. The overlay is then hidden from the Rust code using the
upgrade_in_event_loop
function.If you keep clicking on the button, you will eventually end up in a situation where the overlay is not hidden. From the logs, I can tell that the
upgrade_in_event_loop
function was called, but its content was not.Now, if we click on a "Rescue" button, it calls another Rust code, which calls the
upgrade_in_event_loop
again. This causes both closures to be processed, first from the "Process" button and then from the "Rescue" button.It seems like the code from the
upgrade_in_event_loop
is put on a queue but sometimes not executed, and only the next call of the function triggers the execution.slint-event-loop.mp4
The text was updated successfully, but these errors were encountered: