tasgon / bevy_iced

Iced integration for Bevy
Other
130 stars 14 forks source link

Crashing if run under Wayland. #27

Open SolidStateDj opened 6 months ago

SolidStateDj commented 6 months ago

Running bevy_iced under Wayland will cause a crash.

thread '<unnamed>' panicked at src/render.rs:116:70:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in exclusive system `bevy_render::renderer::render_system`!
thread 'Compute Task Pool (9)' panicked at /home/dj/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.13.2/src/pipelined_rendering.rs:49:67:
called `Result::unwrap()` on an `Err` value: RecvError
thread '<unnamed>' panicked at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/thread/local.rs:260:26:
cannot access a Thread Local Storage value during or after destruction: AccessError
fatal runtime error: failed to initiate panic, error 5
zsh: IOT instruction (core dumped)  cargo run --example basic

The code tested is the basic.rs example provided, however, all other examples exhibit the exact same behavior.

Additionally, this occurs both when using the officially cloned repo, and when adding bevy_iced = {git = "https://github.com/tasgon/bevy_iced"} as a dependency to a separate project. Furthermore, all of the suggested compile time optimizations provided by Bevy have been tested and make no difference.

This has been tested on the exact same system under X11, and on a separate MacOS machine which both worked as expected.

I speculate that extracted_window.swap_chain_texture_view.as_ref().unwrap() is trying to gain information that it does not have access to under Wayland.

badcodecat commented 6 months ago

I can reproduce this. Although in a different, more complex project (multiple buttons, translated text, various rows and columns) everything works fine on wayland (both with and without the bevy/wayland feature).

UPDATE: after changing unrelated code, my other project now does not work