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.55k stars 601 forks source link

Selecting live preview in windows snap left/right causes slint LSP to crash (WSL2 ubuntu 22.04 remote from Windows 11) #5275

Closed bertlebee closed 5 months ago

bertlebee commented 5 months ago

reproduction steps:

  1. in WSL cargo generate --git https://github.com/slint-ui/slint-rust-template --name memory
  2. open VS code
  3. open the memory folder using WSL remote extension
  4. open appwindow.slint
  5. use the command palette to show preview
  6. with focus on vscode, press windows key and left (snap left). vscode snaps left, option for windows to fill the right side appear on the right
  7. select the live preview
  8. LSP crashes

Slint LSP output (from vscode)

Failed to initialize Skia GPU renderer: Error creating glutin display for native display Wayland(
    WaylandDisplayHandle {
        display: 0x0000561b1a857320,
    },
): not found . Falling back to software rendering

>>>>>>>>>>>>>Crash happens here <<<<<<<<<<
Io error: Broken pipe (os error 32)
Io error: Broken pipe (os error 32)
Io error: Broken pipe (os error 32)
thread 'main' panicked at tools/lsp/preview/native.rs:83:40:
called `Result::unwrap()` on an `Err` value: Other("Error running winit event loop: Exit Failure: 1")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Info  - 8:55:53 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
The Slint Language Server crashed. This is a bug.
Please open an issue on https://github.com/slint-ui/slint/issues
The Slint Language Server crashed. This is a bug.
Please open an issue on https://github.com/slint-ui/slint/issues
tronical commented 5 months ago

Duplicate of #4089

tronical commented 5 months ago

This sucks :( this crash is caused by WSL’s Weston system compositor crashing:(

tronical commented 5 months ago

Best workaround within WSL is to unset WAYLAND_DISPLAY

bertlebee commented 5 months ago

Thanks for your quick reply!

Best workaround within WSL is to unset WAYLAND_DISPLAY

I added unset WAYLAND_DISPLAY to my .bashrc file and restarted WSL, and I'm still getting the same behaviour (including the skia error talking about wayland, which I wouldn't expect to see if wayland was disabled) - is there anything else I need to do to disable wayland and use X11?

rob@lappy:~$ echo $WAYLAND_DISPLAY

rob@lappy:~$ echo $DISPLAY
:0

This sucks :( this crash is caused by WSL’s Weston system compositor crashing:(

did you end up creating an issue in Weston's repo? I saw on another issue you were going to but I can't see any links to it or find it in Weston issues to see if there's any progress on a solution.

bertlebee commented 5 months ago

installing all the deps listed under https://releases.slint.dev/1.6.0/docs/slint/src/advanced/backend_linuxkms seems to have resolved the issue for me (it now displays weird after snapping, but doesn't crash), I didn't get around to actually setting the backend to linuxkvms. afterwards I installed qt6-base-dev, so I think I'm probably now using that? there's no output at all from the slint lsp in vscode now (it doesn't even show up in the output dropdown), it might be nice to output here and there like what backend/renderer it's using etc.

image