Bug 458764 - Copy and pasting a selection twice in a row produces a blank layer.
Summary: Copy and pasting a selection twice in a row produces a blank layer.
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: * Unknown (show other bugs)
Version: 5.1.0
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2022-09-05 22:39 UTC by Autumn Lansing
Modified: 2022-09-19 19:51 UTC (History)
2 users (show)

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


Attachments
Video of bug (373.79 KB, video/x-matroska)
2022-09-16 18:25 UTC, Autumn Lansing
Details
Krita file used in video (115.46 KB, application/x-krita)
2022-09-16 18:26 UTC, Autumn Lansing
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Autumn Lansing 2022-09-05 22:39:46 UTC
SUMMARY
Copy and pasting a selection twice in a row produces a blank layer. Copying a selected area works the first time, creating a new layer (Layer 2) with a copy of the selection from Layer 1. If you immediately copy and paste from Layer 2, however, it creates a new blank layer (Layer 3), despite the fact that Layer 2 still has an active selection box and one would expect the selection to be copied into Layer 3.

If you create a new selection box around the material in Layer 2, it will copy correctly to Layer 3, but you can no longer do multiple copy and pastes from one original selection. You have to manually reselect the material again.

This used to work correctly prior to 5.0. It may have worked correctly in 5.0 itself but I don't remember if I encountered the problem prior to 5.1 or not.

STEPS TO REPRODUCE
1. Select an area in Layer 1
2. Ctrl C to copy then Ctrl V to paste, which creates Layer 2
3. Immediately Ctrl C and Ctrl V again to create Layer 3

OBSERVED RESULT
Layer 3 is blank.

EXPECTED RESULT
Layer 3 should be a copy of Layer 2

SOFTWARE/OS VERSIONS
Qt

  Version (compiled): 5.12.12
  Version (loaded): 5.12.12

OS Information

  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 5.18.18-200.fc36.x86_64
  Pretty Productname: Fedora Linux 36 (Cinnamon)
  Product Type: fedora
  Product Version: 36
  Desktop: X-Cinnamon

ADDITIONAL INFORMATION
Comment 1 Halla Rempt 2022-09-07 11:51:44 UTC
I'm sorry, but I cannot reproduce this with the 5.1.0 appimage or with a build from current git master.
Comment 2 Autumn Lansing 2022-09-12 17:29:27 UTC
It happens continuously for me. It also happens when I move the copied material. The selection box moves with the new layer and still surrounds the newly-copied material, but Ctrl C and Ctrl V to copy what's on Layer 2 produces a new blank Layer 3.

1. Select and area in Layer 1
2. Ctrl C to copy then Ctrl V to paste, which creates Layer 2
3. Move the newly-copied material on Layer 2 to a different position. The selection box will follow it.
4. Ctrl C and then Ctrl V to create Layer 3. Layer 3 will be blank.

On the Layers docker, there is a visible difference in the shape of the layer icon for Layer 3. For example, in what I just did to test this, Layer 1 and Layer 2 icons are square, but the Layer 3 icon is a narrow, upright rectangle. Hovering over the icons, Layer 1 and Layer 2 show previews of what's on the layer, but Layer 3 shows a blank layer.
Comment 3 Dmitry Kazakov 2022-09-16 11:26:01 UTC
Hi, Autumn!

Could you please make a video of the problem? And, probably, attach a test file. I cannot reproduce this problem, neither on Windows, nor on Linux.
Comment 4 Autumn Lansing 2022-09-16 18:25:28 UTC
Created attachment 152127 [details]
Video of bug

Here's a video of the bug in action.
Comment 5 Autumn Lansing 2022-09-16 18:26:36 UTC
Created attachment 152128 [details]
Krita file used in video

And here's the document from that video.
Comment 6 Bug Janitor Service 2022-09-17 04:36:13 UTC
Thanks for your comment!

Automatically switching the status of this bug to REPORTED so that the KDE team
knows that the bug is ready to get confirmed.

In the future you may also do this yourself when providing needed information.
Comment 7 Dmitry Kazakov 2022-09-19 13:30:25 UTC
Okay, I see what the problem is. The Move Tool action is not finished by the time Ctrl+C is pressed. As a temporary workaround, please just press Enter key after doing the move and pressing Ctrl+C. And I will look for a proper solution in code.
Comment 8 Dmitry Kazakov 2022-09-19 13:43:30 UTC
Git commit b0022ad9b5d71b6a6fdca8fa87c1cdd90a8a9e20 by Dmitry Kazakov.
Committed on 19/09/2022 at 13:43.
Pushed by dkazakov into branch 'master'.

Fix copy-paste operation not working after using the move tool

The copying should force-finish the move operation

M  +2    -0    libs/ui/actions/kis_selection_action_factories.cpp

https://invent.kde.org/graphics/krita/commit/b0022ad9b5d71b6a6fdca8fa87c1cdd90a8a9e20
Comment 9 Dmitry Kazakov 2022-09-19 13:43:52 UTC
Git commit 9ed1797d99fafe31731ec80b1cc085b5cb4540a8 by Dmitry Kazakov.
Committed on 19/09/2022 at 13:43.
Pushed by dkazakov into branch 'krita/5.1'.

Fix copy-paste operation not working after using the move tool

The copying should force-finish the move operation


(cherry picked from commit b0022ad9b5d71b6a6fdca8fa87c1cdd90a8a9e20)

M  +2    -0    libs/ui/actions/kis_selection_action_factories.cpp

https://invent.kde.org/graphics/krita/commit/9ed1797d99fafe31731ec80b1cc085b5cb4540a8
Comment 10 Autumn Lansing 2022-09-19 19:51:19 UTC
Thanks for the workaround, Dmitry. :)