-
Notifications
You must be signed in to change notification settings - Fork 501
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
Panic in software renderer when shrinking window #2957
Comments
I can't reproduce :-( (tried both the native and fluent style, on linux x11) |
I can trivially reproduce it on macOS, but under Linux it's indeed much harder. Under KDE I can reproduce it, but it needs a fair amount of drawing the resize handle of the window back and forth, until eventually it triggers. |
This patch applied to the gallery improves the probability for me to hit the panic: https://gist.github.com/tronical/b52e651c45fd16aa6357449fe9cdcae8 |
This is basicaly the same panic as #2027: The winit backend use the actual size of the window as returned by slint::Window::size(), to allocate a buffer. When resizing, we might get a frame where the sizes are not in sync and cause the problem. What to do?
|
Commit 5fde19d fixed the original issue.
(often reproducable when recizing while on the TextEdit pane) or
(this is with the native style) They seem to relate to the computation of the geometry from floating point may be one pixel off resulting in too small or too big rectangle that takes pixel outside of their source. (esp with a scale factor) |
We ended rendering glyphs with empty or even negative size, causing panics down the line. I added a way in the screenshot tester to change the scale factor CC: #2957
We ended rendering glyphs with empty or even negative size, causing panics down the line. I added a way in the screenshot tester to change the scale factor CC: #2957
In some case, when the clip is, eg on a 0.25 of a pixel, but the offset is 0.75, (such that the begining of the glyph starts at 0.5) difference in rounding in different computation can result in a width which is one pixel bigger than the source image. I couldn't reproduce this in a testcase, but this can be reproduced while resizing or scrolling through a TextEdit I think this fixes #2957 The panic fixed by this commit looks like this: ``` thread 'main' panicked at 'index out of bounds: the len is 131 but the index is 131', /home/olivier/slint/internal/core/software_renderer/draw_functions.rs:81:19 stack backtrace: 3: i_slint_core::software_renderer::draw_functions::draw_texture_line at ./internal/core/software_renderer/draw_functions.rs:81:19 4: <i_slint_core::software_renderer::RenderToBuffer<T> as i_slint_core::software_renderer::ProcessScene>::process_shared_image_buffer at ./internal/core/software_renderer.rs:1023:13 5: i_slint_core::software_renderer::SceneBuilder<T>::draw_text_paragraph::{{closure}} at ./internal/core/software_renderer.rs:1404:37 6: i_slint_core::textlayout::TextParagraphLayout<Font>::layout_lines::{{closure}} at ./internal/core/textlayout.rs:219:17 ```
We ended rendering glyphs with empty or even negative size, causing panics down the line. I added a way in the screenshot tester to change the scale factor CC: #2957
To reproduce:
SLINT_BACKEND=software
and--features slint/renderer-winit-software
Panic:
FWIW it's not a regression against v1.0.0 or even older releases AFAICS.
The text was updated successfully, but these errors were encountered: