Bug 458248

Summary: When pasting copied region from Krita to another application, both applications freeze and stop responding
Product: [Applications] krita Reporter: soitismyankh
Component: * UnknownAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: crash CC: amy, chloe.peiying.lin, halla
Priority: NOR Keywords: triaged
Version: 5.1.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Details regarding copy-paste freeze bug

Description soitismyankh 2022-08-24 12:11:12 UTC
STEPS TO REPRODUCE
1.  Create new document with background as canvas color and one layer
2.  Draw anything on a layer
3.  Select anything on this layer and copy it via ctrl+shift+C
4. Paste it into MS Paint or Telegram via ctrl+V

OBSERVED RESULT
Krita will stop responding, MS Paint or Telegram will stop responding too.

EXPECTED RESULT
The copied region will be pasted as normal.

SOFTWARE/OS VERSIONS
Windows:  10

ADDITIONAL INFO:
After killing Krita via task manager, MS Paint will again start responding and will display a window with "The information on the Clipboard can't be inserted into Paint." text.
Comment 1 soitismyankh 2022-08-24 12:15:19 UTC
I've played with it a bit more and apparently it freezes both applications when copying via Ctrl+A - Ctrl+Shift+C, but when I copy small regions, it's pasting just fine.
Comment 2 amyspark 2022-08-24 17:05:55 UTC
Hi,

Could you please complete the bug report with the information requested here?

https://docs.krita.org/en/untranslatable_pages/reporting_bugs.html#be-complete-and-be-completely-clear

In particular, please send the image you were trying to copy&paste, or alternatively, its dimensions and bit depth.
Comment 3 soitismyankh 2022-08-25 12:10:06 UTC
Created attachment 151580 [details]
Details regarding copy-paste freeze bug
Comment 4 Bug Janitor Service 2022-08-26 04:35:51 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 5 Halla Rempt 2022-09-07 12:13:16 UTC
I could not reproduce this on Windows 11 with Krita 5.1.0 and MS Paint. I saw in your screenshot that you had the recorder on, but if I do that, still no problems.
Comment 6 chloe.peiying.lin 2022-09-13 01:24:35 UTC
I also get this bug on Linux Mint 5.15.0
Comment 7 amyspark 2022-09-13 12:50:56 UTC
Switching to confirmed because multiple people have reported a similar issue.
Comment 8 Dmitry Kazakov 2022-09-16 11:08:41 UTC
Git commit aac9375843b3018564cea285b91f82c7f3b9fda2 by Dmitry Kazakov.
Committed on 16/09/2022 at 11:07.
Pushed by dkazakov into branch 'master'.

Fix a crash when trying to copy-paste the background layer

Such layers usually have non-transparent default pixel, which
automatically needs an image for exact bounds calculation, which
doesn't exist for the detached layers.

The patch saves the copied area bounds on the construction
of mime data, much before the layers become detached.
Related: bug 458890, bug 458857, bug 458941

M  +12   -11   libs/ui/kis_mimedata.cpp
M  +2    -0    libs/ui/kis_mimedata.h

https://invent.kde.org/graphics/krita/commit/aac9375843b3018564cea285b91f82c7f3b9fda2
Comment 9 Dmitry Kazakov 2022-09-16 11:09:32 UTC
Git commit 1d9698635a0f8289263bcb057727bf69cb48e8fa by Dmitry Kazakov.
Committed on 16/09/2022 at 11:09.
Pushed by dkazakov into branch 'krita/5.1'.

Fix a crash when trying to copy-paste the background layer

Such layers usually have non-transparent default pixel, which
automatically needs an image for exact bounds calculation, which
doesn't exist for the detached layers.

The patch saves the copied area bounds on the construction
of mime data, much before the layers become detached.
Related: bug 458890, bug 458857, bug 458941


(cherry picked from commit aac9375843b3018564cea285b91f82c7f3b9fda2)

M  +12   -11   libs/ui/kis_mimedata.cpp
M  +2    -0    libs/ui/kis_mimedata.h

https://invent.kde.org/graphics/krita/commit/1d9698635a0f8289263bcb057727bf69cb48e8fa