Bug 502444 - Clipboard keeps reverting to previous state with QT_QPA_PLATFORM=wayland-egl set
Summary: Clipboard keeps reverting to previous state with QT_QPA_PLATFORM=wayland-egl set
Status: RESOLVED NOT A BUG
Alias: None
Product: plasmashell
Classification: Plasma
Component: Clipboard widget & pop-up (other bugs)
Version First Reported In: 6.3.4
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2025-04-05 11:13 UTC by Joaquim Monteiro
Modified: 2025-05-28 00:13 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Video of the bug (1.92 MB, video/webm)
2025-04-05 11:13 UTC, Joaquim Monteiro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joaquim Monteiro 2025-04-05 11:13:09 UTC
Created attachment 180024 [details]
Video of the bug

SUMMARY
Clipboard reverts to previous state when focus switches from application to plasma-shell, until the clipboard history is erased.

STEPS TO REPRODUCE
1. Copy a piece of text and ensure it gets saved to the clipboard history.
2. Copy something else.
3. Move the mouse to a plasma-shell surface (the desktop, taskbar, clipboard settings window, etc.).
4. Try pasting the text.

OBSERVED RESULT
The first text (the one saved to the clipboard history) gets pasted.

EXPECTED RESULT
The text copied second gets pasted.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 6.3.4 (not a new bug, I'm pretty sure it happened in 6.2, and maybe earlier)
KDE Frameworks Version: 6.12.0
Qt Version: 6.9.0

ADDITIONAL INFORMATION
This bug **does not happen** if you switch straight from the program you copied from to the program you paste in. The clipboard only reverts to the saved value once focus goes to plasma-shell.

See the attached video, it demonstrates all of this.
Comment 1 Fushan Wen 2025-04-11 04:50:03 UTC
Cannot reproduce on Wayland using the exact same settings in the video
Comment 2 Joaquim Monteiro 2025-04-11 06:43:11 UTC
I turned on debug logging, here's what I found.

After copying the word "kde" (and making sure it appears in the clipboard history), the following logs are produced:

```
org.kde.klipper: Checking clip data
org.kde.klipper: was empty. Retried, now still empty
org.kde.klipper: Checking clip data
org.kde.klipper: was empty. Retried, now still empty
org.kde.klipper: Checking clip data
org.kde.klipper: Synchronize? false
org.kde.klipper: Checking clip data
org.kde.klipper: Checking clip data
org.kde.klipper: was empty. Retried, now still empty
org.kde.klipper: Resetting clipboard (Prevent empty clipboard)
org.kde.klipper: Checking clip data
org.kde.klipper: was empty. Retried, now still empty
org.kde.klipper: Resetting clipboard (Prevent empty clipboard)
org.kde.klipper: Setting clipboard to < "kde" >
org.kde.klipper: Setting selection to < "kde" >
```

If I then copy anything else, I get an infinite loop of the following messages *before* I even move the cursor off the app I'm copying from:

```
org.kde.klipper: Checking clip data
org.kde.klipper: was empty. Retried, now still empty
org.kde.klipper: Resetting clipboard (Prevent empty clipboard)
org.kde.klipper: Setting clipboard to < "kde" >
org.kde.klipper: Checking clip data
org.kde.klipper: was empty. Retried, now still empty
org.kde.klipper: Resetting clipboard (Prevent empty clipboard)
org.kde.klipper: Setting selection to < "kde" >
```

At this point, the clipboard still has the new value (not "kde").

After I move the cursor off the app, I get:

```
org.kde.klipper: Checking clip data
org.kde.klipper: was empty. Retried, now still empty
org.kde.klipper: Resetting clipboard (Prevent empty clipboard)
org.kde.klipper: Setting selection to < "kde" >
org.kde.klipper: Setting clipboard to < "kde" >
```

And the clipboard reverts to "kde".
Comment 3 Fushan Wen 2025-04-18 13:13:46 UTC

*** This bug has been marked as a duplicate of bug 502831 ***
Comment 4 Joaquim Monteiro 2025-05-27 19:24:30 UTC
I discovered what causes this while working on something else. It is not a duplicate of bug 502831.

This happens when plasmashell is run with `QT_QPA_PLATFORM=wayland-egl`. Plasma does not set this variable, so the majority of users should be unaffected.
Comment 5 Nate Graham 2025-05-28 00:13:49 UTC
Thanks for following up about that! Changing the title to reflect the actual issue