https://bugs.kde.org/show_bug.cgi?id=507640

            Bug ID: 507640
           Summary: PNG encoding issue in Spectacle while copying data to
                    the Plasmashell Clipboard
    Classification: Applications
           Product: Spectacle
      Version First 6.4.3
       Reported In:
          Platform: Neon
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: General
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

Created attachment 183638
  --> https://bugs.kde.org/attachment.cgi?id=183638&action=edit
Journald screenshot

SUMMARY
There is an error introduced in version 6.4.3 of spectacle while copying image
data to the clipboard. It seems to be a PNG encoding issue on Spectacle's side
that prevents plasmashell from decoding it.

STEPS TO REPRODUCE
1. Open Spectacle tool (via any way, K menu or PrintScr option) and select a
display portion to copy to the clipboard.
2. Press Ctrl+C to copy the selected area to the clipboard.
3. Try to paste the image into any app, for example Dolphin, Krita, Telegram,
etc.
4. Around half of the time, the image will silently fail to be pasted. Like
nothing is on the clipboard.
5. Run `journalctl -xe --user`. when the copy operation fails you will see
errors between Spectacle and Plasmashell failing to copy the image into the
clipboard.

OBSERVED RESULT

When taking an screenshot, it doesnt matter if its a whole display or a
portion, if the image is set to be copied into the clipboard it fail to be
copied around 50% of the time.
The error seems to be a PNG encoding issue. When the copy operation fails there
is an error log in the user's journal. 
```text
ul 29 18:38:52 PLATINUM plasmashell[2801]: DataControlOffer: timeout reading
from pipe for mimeType application/x-qt-image
jul 29 18:38:52 PLATINUM spectacle[278131]: Failed to send all clipobard data;
sent -1 bytes out of 5891351
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while
reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while
reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while
reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]:
qrc:/qt/qml/org/kde/plasma/private/clipboard/ImageItemDelegate.qml:26:9: QML
Image: Cannot open:
file:///home/kderazorback/.local/share/klipper/data/9c52b7bc5f0cf645dc2a47033d1adee97c420314/9c52b7bc5f0cf645dc2a47033d1adee97c420314
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while
reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while
reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while
reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while
reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while
reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while
reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]:
qrc:/qt/qml/org/kde/plasma/private/clipboard/ImageItemDelegate.qml:26:9: QML
Image: Error decoding:
file:///home/kderazorback/.local/share/klipper/data/da39a3ee5e6b4b0d3255bfef95601890afd80709/da39a3ee5e6b4b0d3255bfef95601890afd80709:
Unsupported image format
jul 29 18:38:54 PLATINUM kwin_wayland[2583]: kwin_scene_opengl: Could not
delete texture because no context is current
jul 29 18:39:00 PLATINUM plasmashell[2801]: IFFChunk::innerFromDevice: unkwnown
chunk "\x89PNG"
jul 29 18:39:00 PLATINUM Telegram[30703]: QWaylandDataOffer: timeout reading
from pipe
jul 29 18:39:00 PLATINUM Telegram[30703]: QWaylandDataOffer: error reading data
for mimeType application/x-qt-image
jul 29 18:39:01 PLATINUM spectacle[278131]: Failed to send all clipobard data;
sent -1 bytes out of 5891351
jul 29 18:39:01 PLATINUM Telegram[30703]: QWaylandDataOffer: timeout reading
from pipe
jul 29 18:39:01 PLATINUM Telegram[30703]: QWaylandDataOffer: error reading data
for mimeType image/png
jul 29 18:39:01 PLATINUM plasmashell[2801]: IFFChunk::innerFromDevice: unkwnown
chunk "\x89PNG"
jul 29 18:39:02 PLATINUM spectacle[278131]: Failed to send all clipobard data;
sent -1 bytes out of 5891351
jul 29 18:39:02 PLATINUM Telegram[30703]: QWaylandDataOffer: timeout reading
from pipe
jul 29 18:39:02 PLATINUM Telegram[30703]: QWaylandDataOffer: error reading data
for mimeType image/avif
jul 29 18:39:02 PLATINUM spectacle[278131]: Failed to send all clipobard data;
sent -1 bytes out of 382283
```
If the clipboard history is opened with Win+V, it will recognize the copied
entry as a empty, preventing its selection/paste.

WORKAROUND
Set up spectacle to keep its window open after screenshot, after confirming the
screenshot, wait for the preview/results popup and then press Ctrl+C a couple
of times to guarantee its actually copied to the clipboard. This will
brute-force the copy action until it works.


EXPECTED RESULT
The image should be copied every time Ctrl+C is pressed while capturing the
screen or while doing the shortcut on the Spectacle preview window.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE neon User Edition
KDE Plasma Version: 6.4.3
KDE Frameworks Version: 6.16.0
Qt Version: 6.9.1
Kernel Version: 6.14.0-24-generic (64-bit)
Graphics Platform: Wayland
Processors: 24 × 13th Gen Intel® Core™ i7-13700
Memory: 64 GiB of RAM (62.5 GiB usable)
Graphics Processor 1: Intel® Graphics
Graphics Processor 2: AMD Radeon RX 6700 XT

Package: kde-spectacle
Version: 1:6.4.3-0zneon+24.04+noble+release+build38

At the time of filling the bug there is no more recent version of Spectacle
available.

ADDITIONAL INFORMATION
This was introduced in KDE with the latest big update made to Spectacle.
I searched the bug board here but other entries seem to be related to other
similar errors with different causes, so I'm creating a new one specifically
mentioning the PNG encoding issue.

The only ticket I could find that may be the same issue is:
https://bugs.kde.org/show_bug.cgi?id=506781
But I'm not exactly sure since it does not contain too many details and even
when confirmed no detail was provided by the assignee.

By the way, there is also a typo in the error message logged by spectacle to
the journal. It says `clipobard` instead of `clipboard`. This is a minor issue
but solving it would make `grepping` the journal a lot easier.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to