slint-ui / slint

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

LSP crashes when showing PopupWindow #4884

Closed bluecookies closed 6 months ago

bluecookies commented 6 months ago

Using the live preview extension on VSCode, Windows 10, Slint v1.5.0

The following .slint snippet that tries to show a popup window with a callback in a separate component:

component DialogBox inherits Rectangle {
    callback show-dialog();

    show-dialog() => {
        dialog.show();
    }

    dialog := PopupWindow { }
}

component MainWindow inherits Window {
    dialog := DialogBox { }
    TouchArea { 
        clicked => {
            dialog.show-dialog();
        }
    }
}

crashes with the following

thread 'main' panicked at internal\interpreter\eval.rs:556:22:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7ff67e1e27b9 - <unknown>
   1:     0x7ff67da37b7d - <unknown>
   2:     0x7ff67e1d16d1 - <unknown>
   3:     0x7ff67e1e44ba - <unknown>
   4:     0x7ff67e1e3d89 - <unknown>
   5:     0x7ff67e1e4be0 - <unknown>
   6:     0x7ff67e1e469b - <unknown>
   7:     0x7ff67e1e4619 - <unknown>
   8:     0x7ff67e1e4602 - <unknown>
   9:     0x7ff67e8aced7 - <unknown>
  10:     0x7ff67e8ad0a2 - <unknown>
  11:     0x7ff67dfe2e2f - <unknown>
  12:     0x7ff67dfd5b62 - <unknown>
  13:     0x7ff67dfd60bb - <unknown>
  14:     0x7ff67dfceb04 - <unknown>
  15:     0x7ff67dfdc67c - <unknown>
  16:     0x7ff67dfd67cf - <unknown>
  17:     0x7ff67dfd60bb - <unknown>
  18:     0x7ff67dfee54b - <unknown>
  19:     0x7ff67dfcf9e1 - <unknown>
  20:     0x7ff67dcdfb15 - <unknown>
  21:     0x7ff67dce888d - <unknown>
  22:     0x7ff67dade52d - <unknown>
  23:     0x7ff67dada3fd - <unknown>
  24:     0x7ff67dad9621 - <unknown>
  25:     0x7ff67dad9238 - <unknown>
  26:     0x7ff67dabbd85 - <unknown>
  27:     0x7ff67daa189b - <unknown>
  28:     0x7ffeb881ef75 - CallWindowProcW
  29:     0x7ffeb881e9ee - CallWindowProcW
  30:     0x7ffe78fcf0f0 - glPushClientAttrib
  31:     0x7ffeb881ef75 - CallWindowProcW
  32:     0x7ffeb881e69d - DispatchMessageW
  33:     0x7ff67da9c375 - <unknown>
  34:     0x7ff67dad48e1 - <unknown>
  35:     0x7ff67e1cb0d9 - <unknown>
  36:     0x7ff67e1956c6 - <unknown>
  37:     0x7ff67e1c952d - <unknown>
  38:     0x7ff67e8aad5c - <unknown>
  39:     0x7ffeb8ef7344 - BaseThreadInitThunk
  40:     0x7ffeb94226b1 - RtlUserThreadStart
[Info  - 7:05:24 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
ogoffart commented 6 months ago

Thanks for the bug report! I appreciate the nice small testcase. I can reproduce the problem.