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
Having too many TextEdits causes an invalid_key error in timers.rs #3019
Comments
I could not reproduce the problem with a simple testcase. This is the testcase i used:
|
Weird, it's not crashing mine either, and what's even more odd is that I can use the same logic in a test program that I use in the real thing, and it doesn't crash. The big difference being the widgets I use, and that the files are over 1500 lines long each, and there's a lot more tabbed stuff. |
That's a nice UI you've made. Looking forward to see that released. As for the blinking cursor, maybe this has something to do with focus changes... They way i'd debug that is to "bisect" the UI by removing as many part of the UI as possible while still making the bug visible. If i had access to your application code, i could have a look. Feel free to send me an email if you're comfortable sharing your source code. |
Alright, I cut down the code as much as I could, and the crash only happens when a TextEdit is inside a NikkiScrollArea. Steps to reproduce
It should switch tabs, freeze, then crash the interpreter. Also thank you for the compliment, I've been trying real hard on it! Here's the files for it, just click preview on |
I can Reproduce the bug |
Small testcase:
switching focus between the line edit around 4 times reproduce the blinking issue, then un-focussing the window panics:
(the panic only happens with the winit backend, but the cursor blinking problem happens also with Qt) |
The Flickable cause a "delayed click". So there is a 100ms timer which delay the event handling in case we want to flick the flickable. And then the delayed click event reset the cursor timer. (When the window becomes inactive, the cursor blinking stops with winit, but not with qt, which axplain the difference in behavior with the two backend) Thanks for reporting the issue and providing the testcase! |
Setup Info
Currently using Rust and the latest version of Slint through the main git repository on the winit-femtovg renderer, on Arch Linux with the zen kernel, and using SwayWM on Wayland.
The Problem
The issue involves timers and the TextInput builtin element, for some reason, the more TextEdits there are on a window, the faster each consecutive TextInput cursor will blink, It will also keep creating new timers every time the elements are removed and recreated, such as through a VecModel that is displayed through a
for x in model := TextEdit { text:x.text }
. This will eventually cause the 'Slab' of timers to get corrupted (Still unsure how), and will crash the application due with calls to timers that have ID's outside of the 'Slab'.The crash is also performance dependent, for my project, the VSCode preview runs at about 15 - 20 FPS, and will crash in 5-10 seconds. A release build will get 60FPS and last about 4 - 5 minutes before it crashes. Unsure if this has anything to do with it or is just a side effect.
Now I do have a few STD re-implementation elements using TextInput, but none of them use any functions other than binding to
text
and using theedited
andcursor_position_changed
callbacks.Possible Cause?
I believe it is a form of memory corruption since I did some probing, if you do sanity checks between
activate_timer
andregister_active_timer
, Even though they are called consecutively without modification toself.timers
, it will report thatactivate timer
has a valid timer ID whileregister_active_timer
does not, which leads to theinvalid_key
error.I usually don't report bugs, but this has been getting in the way of my project and my quick fix was to essentially disable most timers. This significantly improved stability, but now things like blinking cursors and such do not work properly.
The Project
This project is going to be my take on what 'Manuskript' is, and the portion for editing character information involves lots and lots of TextEdits, LineEdits, and others. I can provide code to part of my STD Widgets on request, but beware that it's still very much in its 'sketch' phase, and is of rather poor quality (and documentation).
Thank you for your time.
The text was updated successfully, but these errors were encountered: