Skip to content

klipper: perform roundtrip to fix infinite loop when syncing clipboard and selection on Wayland

Fushan Wen requested to merge work/fuf/466414 into master

Reason for the change

When Klipper receives a selection update event, it will try to update the clipboard when Text selection - Always save in history is enabled. On X11 the loop is prevented by the lock level in the same context. On Wayland the new clipboard event is received in a new context due to the asynchronous nature, so the lock level doesn't work. This adds a roundtrip to make the new clipboard event received in the same context so an infinite loop can be avoided.

Test plan

  1. Enable "Text selection - Always save in history" in Klipper on Wayland
  2. Select some text
  3. Watch the CPU usage of plasmashell

Screenshots or screen recordings

Bugs fixed

BUG: 466414 FIXED-IN: 6.1

Closes #126 (closed)

Merge request reports