Skip to content
Commit 0cbe7da1 authored by David Redondo's avatar David Redondo 📖
Browse files

klipper: Insert items before remove

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)
parent 42bb04f2
Pipeline #343533 failed with stage
in 8 minutes and 49 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment