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.61k stars 605 forks source link

Panic opening a combobox in PopupWindow. #4300

Open wwstory opened 10 months ago

wwstory commented 10 months ago

The following test-case panics in the interpreter when selecting an item in the combo box:

import { ComboBox } from "std-widgets.slint";
export component Demo {
    width: 300px;
    height: 100px;

    Text {
        text: "Click on background to show popup";
    }

    TouchArea {
        clicked => {
           popup.show();
        }
    }

    popup := PopupWindow {
        x: parent.width / 2; y: 20px;
        ComboBox {
            model: ["First", "Second", "Third"];
        }
    }
}
thread 'main' panicked at internal/interpreter/eval.rs:1436:26:
called `Option::unwrap()` on a `None` value

Head of the stack trace on macOS:

* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00007ff8089d37a2 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007ff808a0bf30 libsystem_pthread.dylib`pthread_kill + 262
    frame #2: 0x00007ff80892aa49 libsystem_c.dylib`abort + 126
    frame #3: 0x0000000101522939 slint-viewer`panic_abort::__rust_start_panic::abort::h689d47a6d554dc64 at lib.rs:43:17 [opt]
    frame #4: 0x0000000101522929 slint-viewer`__rust_start_panic at lib.rs:38:5 [opt]
    frame #5: 0x00000001015139ed slint-viewer`rust_panic at panicking.rs:831:25 [opt]
    frame #6: 0x0000000101513838 slint-viewer`std::panicking::rust_panic_with_hook::h28420d44f043d3a5 at panicking.rs:801:5 [opt]
    frame #7: 0x000000010151355c slint-viewer`std::panicking::begin_panic_handler::_$u7b$$u7b$closure$u7d$$u7d$::h6f886c0e89185cdc at panicking.rs:649:13 [opt]
    frame #8: 0x0000000101512569 slint-viewer`std::sys_common::backtrace::__rust_end_short_backtrace::h7ca2b2ff22d46410 at backtrace.rs:170:18 [opt]
    frame #9: 0x00000001015132e2 slint-viewer`rust_begin_unwind at panicking.rs:645:5 [opt]
    frame #10: 0x000000010158f9d5 slint-viewer`core::panicking::panic_fmt::h52dad7a658d9bf41 at panicking.rs:72:14 [opt]
    frame #11: 0x000000010158fa67 slint-viewer`core::panicking::panic::ha1c871ecc7d4b1cb at panicking.rs:127:5 [opt]
    frame #12: 0x00000001003263fe slint-viewer`core::option::Option$LT$T$GT$::unwrap::h3949f7f8a76c8fd7(self=Option<&std::collections::hash::map::HashMap<alloc::string::String, core::pin::Pin<alloc::rc::Rc<dyn slint_interpreter::global_component::GlobalComponent, alloc::alloc::Global>>, std::collections::hash::map::RandomState>> @ 0x00007ff7bfef5160) at option.rs:931:21
    frame #13: 0x00000001001fb9c3 slint-viewer`slint_interpreter::eval::enclosing_component_instance_for_element::hacb5866e9f9ef381(element=0x00007ff7bfef59f8, component_instance=ComponentInstance @ 0x00007ff7bfef5450, (null)=Guard @ 0x00007ff7bfef5207) at eval.rs:1430:22
    frame #14: 0x00000001001f95aa slint-viewer`slint_interpreter::eval::load_property_helper::hb134f61f045a7a9f(component_instance=ComponentInstance @ 0x00007ff7bfef59e8, element=0x00007ff7bfef59f8, name=(data_ptr = "background", length = 10)) at eval.rs:1154:11
    frame #15: 0x00000001001efc86 slint-viewer`slint_interpreter::eval::eval_expression::hf5cb118498ceaf44(expression=0x00006000017273e0, local_context=0x00007ff7bfef7500) at eval.rs:153:13
    frame #16: 0x0000000100234f35 slint-viewer`slint_interpreter::dynamic_item_tree::make_binding_eval_closure::_$u7b$$u7b$closure$u7d$$u7d$::hf1b8292b4e3c2017 at dynamic_item_tree.rs:1261:9
    frame #17: 0x00000001002ca550 slint-viewer`_$LT$alloc..boxed..Box$LT$F$C$A$GT$$u20$as$u20$core..ops..function..Fn$LT$Args$GT$$GT$::call::h34e4b17f32b909e1(self=0x000060000281f590, args=<unavailable>) at boxed.rs:2021:9
    frame #18: 0x00000001002013e6 slint-viewer`_$LT$i_slint_core..rtti..MaybeAnimatedPropertyInfoWrapper$LT$Item$C$i_slint_core..properties..Property$LT$T$GT$$GT$$u20$as$u20$i_slint_core..rtti..PropertyInfo$LT$Item$C$Value$GT$$GT$::set_binding::set_binding_impl::_$u7b$$u7b$closure$u7d$$u7d$::h2c2eded4abb0f01a at rtti.rs:210:25
    frame #19: 0x000000010020a07c slint-viewer`_$LT$F$u20$as$u20$i_slint_core..properties..Binding$LT$T$GT$$GT$::evaluate::h3e3a32a32c0e6b9e(self=0x000060000281f590, _value=0x00007fe7e5036b50) at properties.rs:708:9
    frame #20: 0x00000001002e7f67 slint-viewer`i_slint_core::properties::Property$LT$T$GT$::set_binding::_$u7b$$u7b$closure$u7d$$u7d$::he8697960970ef94b(val=0x00007fe7e5036b50) at properties.rs:901:28
    frame #21: 0x0000000100307c11 slint-viewer`_$LT$F$u20$as$u20$i_slint_core..properties..BindingCallable$GT$::evaluate::hc83c7788a02b8f44(self=Pin<&i_slint_core::properties::{impl#8}::set_binding::{closure_env#0}<i_slint_core::graphics::brush::Brush, i_slint_core::rtti::{impl#2}::set_binding::set_binding_impl::{closure_env#0}<i_slint_core::graphics::brush::Brush, slint_interpreter::api::Value>>> @ 0x00007ff7bfef7728, value=0x00007fe7e5036b50) at properties.rs:292:9
    frame #22: 0x0000000100300c03 slint-viewer`i_slint_core::properties::alloc_binding_holder::evaluate::_$u7b$$u7b$closure$u7d$$u7d$::h7bdac3ae2ddf3474 at properties.rs:395:13
    frame #23: 0x00000001002e3300 slint-viewer`i_slint_core::properties::CURRENT_BINDING::_$LT$impl$u20$i_slint_core..properties..CURRENT_BINDING$GT$::set::hfc9b2ca6d4bd3b37(self=0x00000001017a8640, t=Option<core::pin::Pin<&i_slint_core::properties::BindingHolder<()>>> @ 0x00007ff7bfef77a0, f={closure_env#0}<i_slint_core::properties::{impl#8}::set_binding::{closure_env#0}<i_slint_core::graphics::brush::Brush, i_slint_core::rtti::{impl#2}::set_binding::set_binding_impl::{closure_env#0}<i_slint_core::graphics::brush::Brush, slint_interpreter::api::Value>>> @ 0x00007ff7bfef77d0) at lib.rs:265:25
FloVanGH commented 10 months ago

Hi, thank you for your report. Can you give us some details about your setup like operation system, Slint version, selected style, ... ? Thanks

tronical commented 10 months ago

I can reproduce it. Will edit the description with a test case.

wwstory commented 10 months ago

Hi, thank you for your report. Can you give us some details about your setup like operation system, Slint version, selected style, ... ? Thanks

Debian 12, dwm (release to windows7 is the same) slint 1.3.2 native style (other styles are the same)

timsaya commented 10 months ago

me too , also in PopupWindow ComboBox crash macOS 13.6.3 slint 1.3.2 native style

ogoffart commented 10 months ago

Same for me:

SlintPad link (added close-on-click:false and the panic can be seen in the console when opening the combobox)

Linux Firefox Slint 1.3.2

ogoffart commented 10 months ago

Probably related to https://github.com/slint-ui/slint/issues/4356