( Krita 5.3.1 ) Bug : Copy-pasting a selection causes Krita to crash

Hello!

I believe I may have found a bug, and would appreciate the help of anyone willing to attempt to reproduce it.

Description:
Copy-pasting a selection as a Layer causes Krita to dump core / segfault in some conditions

Version:
Krita 5.3.1 (git 9069dbc), AppImage

Operating System: Manjaro Linux
GPU: NVidia

I have tested and confirmed I can also reproduce the bug on a fresh install of Krita, with configuration files properly removed from relevant locations.

I have tested and confirmed I cannot seem to reproduce it in Krita 5.2.11

How to reproduce:

  1. Open Krita, create a new canvas

  2. Select the “Rectangular Selection Tool”

  3. Make a selection on the canvas

  4. Press “Ctrl-c” to copy the Selection

  5. Click in the empty space in the “Layers” docker, this seems to greatly increase the chances of observing the bug

  6. Press “Ctrl-v” to paste the layer

Expected outcome:

The selection is pasted as a new Layer

Observed outcome:

Krita crashes

Hello @spacespider and welcome to the forum :slight_smile:

I don’t have this problem with the 5.3.1 (git 9069dbc) appimage on Linux Mint.
After pressing Ctrl+V in the layers docker, a new layer is created with either no content or painted content depending on the content of the selection that was made.

Do you have a crash if you use the Copy to New Layer button on the selections floating toolbar?

What if you do the Ctrl+V after you select a paint layer in the layers docker instead of clicking on the empty space in the layers docker?
What if you do Edit → Paste instead of Ctrl+V ?

Can you try the 5.2.16 appimage:
https://download.kde.org/Attic/krita/5.2.16/krita-5.2.16-x86_64.AppImage
and the 5.3.0 appimage:
https://download.kde.org/stable/krita/5.3.0/krita-5.3.0-x86_64.AppImage
(The 5.3.0 appimage might be moved into the ‘Attic’ soon.)

This reminds me of other bugs where external software messing with the clipboard ends up corrupting it somehow. There’s this bug report about the XFCE clipboard manager and there’s also one somewhere about some proprietary clipboard thing on macOS. Are you maybe (inadvertently) running one of those things?

Also, what window manager are you running, and are you using X11 or Wayland? If you can switch between them on your login screen, does using one or the other make the problem go away?

Thanks for the suggestions and the links to additional Krita versions @AhabGreybeard, they are very welcome and have proven useful. Also thanks for the warm welcome.

Those old versions have given me the opportunity to test the appimage with the identical version to the one I currently have installed by Manjaro’s package manager.
Good thing, too! I have found they respond very differently.

@Drawpile I am still looking into the bug report you have linked, however from a quick read the folks at XFCE do not seem to be fully certain of what causes the bug, or if it even is within XFCE, Krita, or somewhere else. I may try and look closer into all that and see if I find something.
I believe this may also be of interest to you: copy/pasting in krita crashes the program (#141) ¡ Issues ¡ Xfce / libxfce4ui ¡ GitLab

All the following numbered tests are done with the bug-causing
“(select)-(copy)-(click Layers docker)-(paste)” pattern detailed before
unless otherwise specified

Test Conditions:

  1. performed with custom canvas
    Dimensions:
    custom canvas 1024x1024
    resolution 100 pixels/Inch
    Model: RGB/Alpha
    Depth: 8 bit/channel
    Profile: sRGB-elle-V2-srgbtrc.icc (Default)
    Content:
    Name: Unnamed
    Layers: 1
    Background: White 100% opacity
    [x] as raster layer

  2. performed with “Texture Template”
    Texture 1024x1024 8bit srgb
    As-is, no painting on the texture, just immediately perform the crash-inducing sequence
    note that the default selected layer is full of only transparent pixels

  3. performed with “Texture Template”
    Texture 1024x1024 8bit srgb
    note that the default selected layer is full of only transparent pixels
    I paint on some of the transparent layer of the texture before making the selection

The results are, for the following Krita versions:

Krita 5.2.11 (from Manjaro Linux’s package manager)

  1. seems immune to crash, tested multiple times
  2. seems immune to crash, tested multiple times
  3. seems immune to crash, tested multiple times

all tested official appimages:
krita-5.2.11-x86_64 (git a4da714) appimage
krita-5.2.16-x86_64 (git 7d9aefc) appimage
krita-5.3.0-x86_64 (git 148ce5c) appimage
krita-5.3.1-x86_64 (git 9069dbc) appimage

  1. crash on first try
  2. no crash, even with repeated select-copy-paste cycles
  3. crash on selecting and copy-pasting a region of a selected Layer containing colored pixels

Additional observations:

The “Copy to New Layer” button on the floating toolbar seems completely immune to the bug, it just works.

“Edit → Paste” is seemingly identical in behavior to “ctrl-v” in all tests, same for “Edit → Copy” and “ctrl-c”

Pressing “ctrl-c” to copy the selection, followed by “ctrl-v”, without clicking or interacting with anything else (be it krita or other windows), does not cause a crash.

The crash still occurs if clicking on a Layer instead of clicking the empty space within the Layers Docker.

Interacting with anything else I’ve tried (krita or other windows) after “ctrl+c” does cause the crash to occur when pressing “ctrl-v” with Krita focused.

I have tried both with and without “xfce4-clipman” running, the bug persists.

As stated above, interestingly Krita 5.2.11 from Manjaro Linux’s repositories does not exhibit this bug at all, regardless of xfce4-clipman or other unknown factors.
It only seems to occur with Krita when it is packaged as an appimage.

The desktop environment is XFCE, on X11
I sadly do no currently have the means to test wayland on my environment.

Testing on freshly installed Linux Mint Virtual Machines (both XFCE and Cinnamon) confirms on my end that the bug does not seem to occur with appimages on Mint, as @AhabGreybeard mentioned above.

Installing “xfce4-clipman” on the Linux Mint (XFCE) Virtual Machine (and starting it, of course), does not cause a crash to become possible.

Thank you for the wide ranging and detailed test reports :+1:

This does seem to be an OS/DM/utility problem which is outside my experience.

Did you try downgrading xfce4-settings as noted in this bug report comment?:
https://bugs.kde.org/show_bug.cgi?id=502266#c14

I hope that the developers and other users can help track and solve this in the near future.