Skip to content
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

language server crashed #5038

Closed
vede1 opened this issue Apr 10, 2024 · 5 comments · Fixed by #5051
Closed

language server crashed #5038

vede1 opened this issue Apr 10, 2024 · 5 comments · Fixed by #5051
Labels
a:compiler Slint compiler internal (not the codegen, not the parser) bug Something isn't working

Comments

@vede1
Copy link

vede1 commented Apr 10, 2024

export component R1 inherits Rectangle {
    t := TouchArea { }

    states [
        hover when t.has-hover: {
            background: white;
        }
    ]
}

export component R2 inherits R1 { }

export component AppWindow inherits Window {
    R2 {
        states [
            s1 when mp.visible: {
                background: white;
            }
        ]

        mp := Rectangle {
            visible: false;
        }
    }
}
thread 'main' panicked at internal/interpreter/eval.rs:1398:71:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Info  - 6:02:39 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
@hunger
Copy link
Member

hunger commented Apr 11, 2024

We will take a while to get into this issue as everybody is at the embedded world conference this week. Sorry.

@hunger hunger added bug Something isn't working a:lsp slint-lsp and formating (mO,bT) labels Apr 11, 2024
@hunger
Copy link
Member

hunger commented Apr 12, 2024

I can reproduce this: The LSP seems fine though, the Live preview crashes (but since both are in the same binary, the difference is of course not really user-visible;-).

Here is the backtrace I get when I click on Show Preview on AppWindow:

thread 'main' panicked at internal/interpreter/eval.rs:1397:71:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
             at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/std/src/panicking.rs:646:5
   1: core::panicking::panic_fmt
             at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/core/src/panicking.rs:141:5
   3: core::option::unwrap_failed
             at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/core/src/option.rs:1984:5
   4: core::option::Option<T>::unwrap
             at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/core/src/option.rs:932:21
   5: slint_interpreter::eval::enclosing_component_for_element
             at /var/home/tobias/src/slint/internal/interpreter/eval.rs:1397:31
   6: slint_interpreter::eval::enclosing_component_instance_for_element
             at /var/home/tobias/src/slint/internal/interpreter/eval.rs:1424:48
   7: slint_interpreter::eval::load_property_helper
             at /var/home/tobias/src/slint/internal/interpreter/eval.rs:1175:11
   8: slint_interpreter::eval::eval_expression
             at /var/home/tobias/src/slint/internal/interpreter/eval.rs:152:13
   9: slint_interpreter::eval::eval_expression
             at /var/home/tobias/src/slint/internal/interpreter/eval.rs:231:23
  10: slint_interpreter::eval::eval_expression
             at /var/home/tobias/src/slint/internal/interpreter/eval.rs:318:19
  11: slint_interpreter::eval::eval_expression
             at /var/home/tobias/src/slint/internal/interpreter/eval.rs:322:30
  12: slint_interpreter::dynamic_item_tree::make_binding_eval_closure::{{closure}}
             at /var/home/tobias/src/slint/internal/interpreter/dynamic_item_tree.rs:1274:9
  13: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/alloc/src/boxed.rs:2032:9
  14: <i_slint_core::rtti::MaybeAnimatedPropertyInfoWrapper<Item,i_slint_core::properties::Property<T>> as i_slint_core::rtti::PropertyInfo<Item,Value>>::set_binding::set_binding_impl::{{closure}}
             at /var/home/tobias/src/slint/internal/core/rtti.rs:210:25
  15: <F as i_slint_core::properties::Binding<T>>::evaluate
             at /var/home/tobias/src/slint/internal/core/properties.rs:710:9
  16: i_slint_core::properties::Property<T>::set_binding::{{closure}}
             at /var/home/tobias/src/slint/internal/core/properties.rs:903:28
  17: <F as i_slint_core::properties::BindingCallable>::evaluate
             at /var/home/tobias/src/slint/internal/core/properties.rs:294:9
  18: i_slint_core::properties::alloc_binding_holder::evaluate::{{closure}}
             at /var/home/tobias/src/slint/internal/core/properties.rs:397:13
  19: i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set
             at /var/home/tobias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/scoped-tls-hkt-0.1.4/src/lib.rs:265:25
  20: i_slint_core::properties::alloc_binding_holder::evaluate
             at /var/home/tobias/src/slint/internal/core/properties.rs:396:9
  21: i_slint_core::properties::PropertyHandle::update::{{closure}}
             at /var/home/tobias/src/slint/internal/core/properties.rs:593:29
  22: i_slint_core::properties::PropertyHandle::access
             at /var/home/tobias/src/slint/internal/core/properties.rs:498:13
  23: i_slint_core::properties::PropertyHandle::update
             at /var/home/tobias/src/slint/internal/core/properties.rs:588:22
  24: i_slint_core::properties::Property<T>::get
             at /var/home/tobias/src/slint/internal/core/properties.rs:794:18
  25: i_slint_core::items::Rectangle::background
             at /var/home/tobias/src/slint/internal/core/items.rs:251:33
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Info  - 12:41:36 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

@hunger hunger added a:live preview The Live preview of slintpad or the LSP (mT,bO) and removed a:lsp slint-lsp and formating (mO,bT) labels Apr 12, 2024
@hunger
Copy link
Member

hunger commented Apr 12, 2024

RUST_BACKTRACE=full cargo run -p slint-viewer -- /tmp/demo/test.slint gives this backtrace:

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.25s
     Running `/var/home/tobias/src/slint/target/debug/slint-viewer /tmp/demo/test.slint`
thread 'main' panicked at internal/compiler/namedreference.rs:48:34:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x55c02fd005b5 - std::backtrace_rs::backtrace::libunwind::trace::h7884d067d1055777
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x55c02fd005b5 - std::backtrace_rs::backtrace::trace_unsynchronized::h6bc4d647cdcfd833
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55c02fd005b5 - std::sys_common::backtrace::_print_fmt::hde15b23869dacdeb
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x55c02fd005b5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9a7c8ebfe0e5a9ea
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x55c02fd30bbb - core::fmt::rt::Argument::fmt::h12ee69ff17c60b9e
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/core/src/fmt/rt.rs:142:9
   5:     0x55c02fd30bbb - core::fmt::write::hafeb62294a20d279
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/core/src/fmt/mod.rs:1153:17
   6:     0x55c02fcfbedf - std::io::Write::write_fmt::h83162bfc67f19d63
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/std/src/io/mod.rs:1843:15
   7:     0x55c02fd0038e - std::sys_common::backtrace::_print::hd55ca7a5e2e3de7e
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x55c02fd0038e - std::sys_common::backtrace::print::he94870e87e3768e8
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x55c02fd019c9 - std::panicking::default_hook::{{closure}}::hd193b85d1d659c30
  10:     0x55c02fd01733 - std::panicking::default_hook::h6de7d4d748c8b263
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/std/src/panicking.rs:292:9
  11:     0x55c02fd01e84 - std::panicking::rust_panic_with_hook::ha4c10d4e371025d4
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/std/src/panicking.rs:789:13
  12:     0x55c02fd01d2d - std::panicking::begin_panic_handler::{{closure}}::h8d8b80cfb6d2af9a
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/std/src/panicking.rs:650:13
  13:     0x55c02fd00a79 - std::sys_common::backtrace::__rust_end_short_backtrace::hedf50fb5defff019
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/std/src/sys_common/backtrace.rs:171:18
  14:     0x55c02fd01a97 - rust_begin_unwind
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/std/src/panicking.rs:646:5
  15:     0x55c02fd2def6 - core::panicking::panic_fmt::hde3e2c796a3a5416
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/core/src/panicking.rs:72:14
  16:     0x55c02fd2df9f - core::panicking::panic::h150613825d1ad83d
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/core/src/panicking.rs:141:5
  17:     0x55c02fd2dc79 - core::option::unwrap_failed::h83da879f26f94880
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/core/src/option.rs:1984:5
  18:     0x55c02f11adc4 - core::option::Option<T>::unwrap::h8bb67adddf6d6d2e
                               at /rustc/c9f8f3438a8134a413aa5d4903e0196e44e37bbc/library/core/src/option.rs:932:21
  19:     0x55c02f11adc4 - i_slint_compiler::namedreference::NamedReference::element::he93ab89019114672
                               at /var/home/tobias/src/slint/internal/compiler/namedreference.rs:48:9
fish: Job 1, 'RUST_BACKTRACE=full cargo run -…' terminated by signal SIGABRT (Abort)

@hunger hunger added a:compiler Slint compiler internal (not the codegen, not the parser) and removed a:live preview The Live preview of slintpad or the LSP (mT,bO) labels Apr 12, 2024
@ogoffart
Copy link
Member

Duplicate of #1461
The issue is fairly hard to solve and will need some refactoring of the compiler to solve it.
Marking as duplicated, but thanks anyway for reporting.

@ogoffart ogoffart closed this as not planned Won't fix, can't repro, duplicate, stale Apr 12, 2024
@ogoffart ogoffart reopened this Apr 12, 2024
@ogoffart
Copy link
Member

Actually, re-opening because the panic could get fixed and replaced by an error just like we did for the original testcase of #1461

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:compiler Slint compiler internal (not the codegen, not the parser) bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants