slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.33k stars 586 forks source link

Panic in draw_border_rectangle #6432

Open yanshay opened 3 weeks ago

yanshay commented 3 weeks ago

The following panic happened once (with many executions), in a relatively large app so can't provide a reproducible scenario or code, so I don't know if this is of value but in case it is:

If any additional information will help to find the root cause let me know.

====================== PANIC ======================
panicked at /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/euclid-0.22.11/src/point.rs:463:25:
called `Option::unwrap()` on a `None` value

Backtrace:

0x420a7259
0x420a7259 - core::option::unwrap_failed
    at /Users/user/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/option.rs:1985
0x420f06e6
0x420f06e6 - core::option::Option<T>::unwrap
    at /Users/user/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/option.rs:935
0x420f0169
0x420f0169 - <i_slint_core::software_renderer::SceneBuilder<T> as i_slint_core::item_rendering::ItemRenderer>::draw_border_rectangle
    at /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/software_renderer.rs:2257
0x420e8970
0x420e8970 - i_slint_core::properties::PropertyTracker<DirtyHandler>::evaluate
    at /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/properties.rs:1451
0x420baac5
0x420baac5 - <i_slint_core::items::BasicBorderRectangle as i_slint_core::items::Item_vtable_mod::Item>::render
    at /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/items.rs:393
0x420cc802
0x420cc802 - i_slint_core::items::Item_vtable_mod::ItemTO::render
    at /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/items.rs:108
0x42011989
0x42011989 - i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorTO::visit_item
    at /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/item_tree.rs:989
0x42019580
0x42019580 - i_slint_core::item_tree::visit_item_tree
    at /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/item_tree.rs:1110
0x420cc829
0x420cc829 - i_slint_core::item_tree::ItemTree_vtable_mod::ItemTreeTO::visit_children_item
    at /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/item_tree.rs:44
0x42011989
0x42011989 - i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorTO::visit_item
    at /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/item_tree.rs:989
ogoffart commented 3 weeks ago

Thanks for filing a bug.

How big is your screen? What happens here is there is a panic when trying to convert a point from f32 to i16. Maybe the Rectangle is really big (more than 35535 pixel or so?)

yanshay commented 3 weeks ago

My screen is 480x320. Pretty small.

I'm rendering larger coordinates (about twice as high) and animating the y to move from one page to the other. The panic took place sometime during that animation.

The only rectangle that might be special is one that forms a circle using rounded square.

If it's in the conversion of f32 to i16, maybe it's because the f32 somehow contained a NAN?

ogoffart commented 3 weeks ago

If it's in the conversion of f32 to i16, maybe it's because the f32 somehow contained a NAN?

That could very well be. Maybe there is a division by zero somewhere.

yanshay commented 2 weeks ago

I got another panic (that already occurred in the past), during the same animation and also seems to be related to rectangle: This one came without any meaningful information in the backtrace. Maybe it's related?

====================== PANIC ======================
panicked at /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/i-slint-core-1.8.0/software_renderer/draw_functions.rs:295:51:
called `Result::unwrap()` on an `Err` value: ()

Backtrace:

0x420101b4
0x42024a36
0x4201ba7e
0x420a14c3
0x420ff26e
0x403791a6