egui: egui 0.20.0 stopped working in WSLg

Describe the bug

When trying to migrate to egui 0.20 my application crashes on startup in my WSLg environment:

❯ ./target/debug/rs_ytdl 
2022-12-09T15:51:36.763895Z ERROR egui_winit::clipboard: Cannot initialize smithay clipboard without a display handle!
2022-12-09T15:51:37.240034Z ERROR arboard::platform::linux::x11: Worker thread errored with: Unknown error while interacting with the clipboard: Connection reset by peer (os error 104)    
2022-12-09T15:51:37.240050Z ERROR arboard::platform::linux::x11: Could not hand the clipboard data over to the clipboard manager: Unknown error while interacting with the clipboard: The X11 server closed the connection    
2022-12-09T15:51:37.240201Z ERROR arboard::platform::linux::x11: Failed to flush the clipboard window. Error: Broken pipe (os error 32)   

When compiling with egui 0.19.0 this does not happen.

Package part of my cargo.toml:

[dependencies]
egui = "0.20.0"
eframe = "0.20.0"
serde = { version = "1", features = ["derive"] }
toml_edit = "0.15.0"
subprocess = "0.2.9"
serde_json = "1.0.89"
ehttp = "0.2.0"
sanitize-filename = "0.4.0"
image = { version = "0.24", features = ["jpeg", "png"] }
egui_extras = { version="0.20.0", features = ["image"] }
reqwest = { version = "0.11.13", features = ["blocking"] }
indexmap = "1.9.2"

# native:
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tracing-subscriber = "0.3"

# web:
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.6"
tracing-wasm = "0.2"


[profile.release]
opt-level = 2 # fast and small wasm

Expected behavior Application starts as in egui 0.19 without crashing.

Desktop (please complete the following information):

  • OS: Windows WSLg (Fedora 36)
  • Version 11

Additional context I’ve been using exactly the same setup as in egui 0.19.0 and all other GUI stuff works fine.

Also in egui 0.19.0 clipboard works perfectly ok in the application, when I e.g. select something in a Text Edit I can copy it just fine.

EDIT: I cross-checked on my M1Pro Macbook and there it works fine. So it really seems to be a breakage with WSLg

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 30 (12 by maintainers)

Most upvoted comments

Interesting, thanks for making that git bisect! So it is something in https://github.com/emilk/egui/pull/2280 that broke WSLg. That’s nice, because it is a pretty small diff so should hopefully be easy to fix 😬.

Could you please try out this attempted fix: https://github.com/emilk/egui/pull/2439