Skip to content

klipper: Insert items before remove

David Redondo requested to merge work/pickklipperfix into Plasma/5.27

If the history size is 1 removing before inserting can lead to a, weird order of event:

  • the clipboard is changed externally
  • klipper is notified and insert is called
  • the only item is removed since count == m_maxSize
  • klipper notices the history is empty and clears the clipboard and selection
  • adds the new item
  • execution continues and klipper is notified selection is now empty
  • to prevent empty selection klipper sets it back to the new item
  • same happens for the clipboard This causes an issue on Wayland since klipper is notified about the clipboard being empty while setting the selection and ignores the change, so it is never set back. Instead do it in a more sensible way add the new clipboard content first and then remove the excess item. This way klipper never unnecessarily clears clipboard and selection. BUG:466041 FIXED-IN:5.27.3

(cherry picked from commit 85a05244)

Merge request reports

Loading