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.56k stars 604 forks source link

Preview crashes when changing Path.commands by state #4080

Open a-erlandsen-z opened 11 months ago

a-erlandsen-z commented 11 months ago

Preview in VS Code crashes when attempting to change a Path command by state.

To reproduce, show preview of the following in VS Code (Slint 1.3.2) :

export component Triangle inherits Rectangle {
    width: 200px;
    height: 200px;
    background: #333333;

    property <bool> Expanded;

    states [
        DownArrow when Expanded : {
            Arrow.commands: "M0,0.75L141.73,0L71.32,85.04L0,0.75z";
        }
        LeftArrow when !Expanded : {
            Arrow.commands: "M84.29,0l0.75,141.73L0,71.32L84.29,0z";
        }
    ]

    Arrow := Path {
        width: 100px;
        fill: #ffffff;
        commands: "M0,0.75L141.73,0L71.32,85.04L0,0.75z";
    }
}
thread 'main' panicked at internal\interpreter\dynamic_item_tree.rs:1476:21:
unknown property commands in Arrow-3
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Info  - 7:48:03 PM] Connection to server got closed. Server will restart.
true
The Slint Language Server crashed. This is a bug.
Please open an issue on https://github.com/slint-ui/slint/issues
emesare commented 11 months ago

I have observed this behavior as well, here.

qarmin commented 11 months ago
thread 'main' panicked at internal/interpreter/dynamic_item_tree.rs:1476:21:
unknown property commands in Arrow-3
stack backtrace:
   0: rust_begin_unwind
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:597:5
   1: core::panicking::panic_fmt
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:72:14
   2: i_slint_compiler::generator::handle_property_bindings_init::handle_property_inner
   3: i_slint_compiler::object_tree::recurse_elem
   4: i_slint_compiler::object_tree::recurse_elem
   5: i_slint_compiler::object_tree::recurse_elem
   6: slint_interpreter::dynamic_item_tree::instantiate
   7: slint_lsp::preview::set_preview_factory::{{closure}}
   8: i_slint_core::component_factory::ComponentFactory::new::{{closure}}
   9: i_slint_core::items::component_container::ComponentContainer::ensure_updated
  10: core::ops::function::FnOnce::call_once
  11: i_slint_core::properties::alloc_binding_holder::evaluate
  12: i_slint_core::properties::Property<T>::get
  13: core::ops::function::FnOnce::call_once
  14: i_slint_core::properties::alloc_binding_holder::evaluate
  15: i_slint_core::properties::Property<T>::get
  16: core::ops::function::FnOnce::call_once
  17: i_slint_core::properties::alloc_binding_holder::evaluate
  18: i_slint_core::properties::Property<T>::get
  19: core::ops::function::FnOnce::call_once
  20: i_slint_core::properties::alloc_binding_holder::evaluate
  21: i_slint_core::properties::Property<T>::get
  22: core::ops::function::FnOnce::call_once
  23: i_slint_core::properties::alloc_binding_holder::evaluate
  24: i_slint_core::properties::Property<T>::get
  25: core::ops::function::FnOnce::call_once
  26: i_slint_core::properties::alloc_binding_holder::evaluate
  27: i_slint_core::properties::Property<T>::get
  28: i_slint_core::input::send_mouse_event_to_item
  29: i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorVTable::new::visit_item
  30: i_slint_core::item_tree::visit_item_tree::{{closure}}
  31: <slint_lsp::preview::ui::slint_generatedPreviewUi::InnerComponent_empty_8 as i_slint_core::item_tree::ItemTree_vtable_mod::ItemTree>::visit_children_item
  32: i_slint_core::input::send_mouse_event_to_item
  33: i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorVTable::new::visit_item
  34: i_slint_core::item_tree::visit_item_tree::{{closure}}
  35: <slint_lsp::preview::ui::slint_generatedPreviewUi::InnerComponent_empty_8 as i_slint_core::item_tree::ItemTree_vtable_mod::ItemTree>::visit_children_item
  36: i_slint_core::input::send_mouse_event_to_item
  37: i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorVTable::new::visit_item
  38: i_slint_core::item_tree::visit_item_tree::{{closure}}
  39: <slint_lsp::preview::ui::slint_generatedPreviewUi::InnerComponent_empty_8 as i_slint_core::item_tree::ItemTree_vtable_mod::ItemTree>::visit_children_item
  40: i_slint_core::item_tree::visit_item_tree::{{closure}}
  41: <slint_lsp::preview::ui::slint_generatedPreviewUi::InnerPreviewUi as i_slint_core::item_tree::ItemTree_vtable_mod::ItemTree>::visit_children_item
  42: i_slint_core::input::send_mouse_event_to_item
  43: i_slint_core::input::process_mouse_input
  44: i_slint_core::window::WindowInner::process_mouse_input
  45: i_slint_backend_winit::event_loop::EventLoopState::process_event
  46: winit::platform_impl::platform::x11::EventLoop<T>::drain_events::{{closure}}
  47: winit::platform_impl::platform::x11::event_processor::EventProcessor<T>::process_event
  48: i_slint_backend_winit::event_loop::EventLoopState::run
  49: <i_slint_backend_winit::Backend as i_slint_core::platform::Platform>::run_event_loop
  50: slint_lsp::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Info  - 10:55:34 PM] Connection to server got closed. Server will restart.
true
The Slint Language Server crashed. This is a bug.
Please open an issue on https://github.com/slint-ui/slint/issues