Bug 497735

Summary: [Wayland] Klipper generates empty items when Spectacle has automatic copying enabled
Product: [Plasma] plasmashell Reporter: Noah Davis <noahadvs>
Component: Clipboard widget & pop-upAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: qydwhotmail
Priority: NOR Keywords: regression, wayland-only
Version First Reported In: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: KF 6.10
Sentry Crash Report:

Description Noah Davis 2024-12-21 01:35:48 UTC
SUMMARY
When Spectacle automatically copies images, empty clipboard entries are shown in the clipboard widget. This does not happen every time. Sometimes two empty entries are generated for a single automatic copy. I missed this issue in my review of https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4664.

STEPS TO REPRODUCE
1. In Spectacle's settings dialog, set "After taking a screenshot: Copy image to clipboard"
2. Open Spectacle in GUI mode.
3. Use the screenshot buttons to take screenshots. Try different types or the same kind multiple times.

OBSERVED RESULT
Empty entries are shown the clipboard widget.

EXPECTED RESULT
Only image entries should be generated when spectacle automatically copies an image.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20241216
KDE Plasma Version: 6.2.80
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.1
Kernel Version: 6.11.8-1-default (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 4800H with Radeon Graphics
Memory: 30.8 GiB of RAM
Graphics Processor 1: AMD Radeon Graphics
Graphics Processor 2: llvmpipe
Manufacturer: Eluktronics
Product Name: THINN-15
Comment 1 Fushan Wen 2024-12-21 10:25:07 UTC
Cannot reproduce on X11. Is it a Wayland-specific issue?
Comment 2 Fushan Wen 2024-12-21 11:00:16 UTC
Can reproduce on Wayland
Comment 3 Bug Janitor Service 2024-12-21 11:44:36 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5014
Comment 4 Bug Janitor Service 2024-12-24 14:00:32 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kguiaddons/-/merge_requests/153
Comment 5 Fushan Wen 2024-12-25 01:27:21 UTC
Git commit cdb2f1bb75850b2823d2a47eee9eabc7cef80d7b by Fushan Wen, on behalf of David Edmundson.
Committed on 25/12/2024 at 01:27.
Pushed by fusionfuture into branch 'master'.

systemclipboard: Cache mimetypes after retrieval

For a given data offer there is no need to fetch the same data multiple
types for the same mimetype. At best it's wasteful, at worse some
applications quit when their mimedata is fetched such as wl-paste or
spectacle and the second time will fail.

This brings the clipboard implementation in line with upstream Qt. This
is important as from Qt6.9 this backend can be dropped.

M  +9    -0    src/systemclipboard/waylandclipboard.cpp

https://invent.kde.org/frameworks/kguiaddons/-/commit/cdb2f1bb75850b2823d2a47eee9eabc7cef80d7b