egui icon indicating copy to clipboard operation
egui copied to clipboard

egui-winit: Ctrl+V blocks the event loop ~25 s when the X11 clipboard owner doesn't respond

Open a-kurczyn opened this issue 2 months ago • 0 comments

Describe the bug

On X11, when the CLIPBOARD selection owner stops responding (e.g. a hung or SIGSTOPped application still owns the clipboard), pressing Ctrl+V in an eframe app freezes the whole window — no input, no redraw — for about 25 seconds.

egui_winit::State::on_keyboard_input calls self.clipboard.get() synchronously on the UI thread when it sees the paste shortcut. arboard's X11 backend then waits up to LONG_TIMEOUT_DUR (4 s) for each text target it tries, so the total stall is several times that.

To Reproduce

  1. On an X11 session: echo hello | xclip -selection clipboard -i &
  2. kill -STOP $(pgrep -n xclip) (the clipboard owner now never answers)
  3. Run any eframe app (e.g. the hello_world example), focus it and press Ctrl+V.
  4. The window stops responding for ~25 s.

Expected behavior

The window stays responsive while the clipboard is being read; a paste that can't be read within a short time is dropped (or delivered later as Event::Paste).

Suggestions

  • Read the clipboard off the UI thread (or with a short timeout) and deliver Event::Paste when the read completes, or
  • let applications opt out of egui-winit's built-in clipboard handling on the paste shortcut, so they can read the clipboard asynchronously themselves.

Environment

  • egui / egui-winit / eframe 0.36.1, arboard 3.6.1
  • Linux (Fedora 44), X11 session (also reproduced under Xvfb)

a-kurczyn avatar Oct 04 '26 15:10 a-kurczyn