Bug 465941 - Crashes when copy pasting null image
Summary: Crashes when copy pasting null image
Status: RESOLVED LATER
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 5.1.5
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: amyspark
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-17 16:02 UTC by myin
Modified: 2023-02-24 07:28 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description myin 2023-02-17 16:02:40 UTC
SUMMARY
Krita crashes when pasting a null/empty image with the following error:
ASSERT (krita): "!qimage.isNull()" in file /usr/src/debug/krita/krita-5.1.5/libs/ui/kis_clipboard.cc, line 460

It is 100% reproducible and it also happened in other cases but didn't know how to reproduce it.

STEPS TO REPRODUCE
1. Select layer with "inherit alpha" enabled
2. Press Ctrl+C
3. Press Ctrl+Shift+N

OBSERVED RESULT

Krita crashes after this. It works if "Inherit Alpha" is disabled

EXPECTED RESULT

Krita should create a new canvas with the layer pasted.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.15.89-1-MANJARO
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 5.15.8

ADDITIONAL INFORMATION
Comment 1 amyspark 2023-02-17 20:25:12 UTC
I'll check this out.
Comment 2 amyspark 2023-02-23 18:38:39 UTC
This is a case of the infamous "clipboard is cleared midway into pasting". In your case, it is caused by selecting "paste from clipboard" in the source selection dialog, but then something in between clears the clipboard. So when the image is fetched from the clipboard, a null QImage is returned, and that doesn't match the expected state.

If you can reproduce it consistently, can you check if you have a password manager active, or something that regularly cleans your clipboard?
Comment 3 myin 2023-02-23 18:54:29 UTC
No, there shouldn't be something like that. But that doesn't explain why it works normally if "Inherit alpha" is disabled. It only crashes when I copy a layer with inherit alpha. Is it not reproducible on your side? I could try it on other machines to check if it's only on my current one.
Comment 4 amyspark 2023-02-23 21:16:21 UTC
Yes, I have 5.1.5 and current master on Windows and neither crash when copying a layer with Inherit Alpha, even after closing the source document.
Comment 5 Bug Janitor Service 2023-02-24 03:45:49 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 6 myin 2023-02-24 07:28:20 UTC
So what I have tested now is:
- In Windows (VM): nothing happens
- In another Linux machine: nothing happens

I guess the normal behaviour is that nothing should happen when I paste an inherit alpha layer as a new document. Pasting in the same documents works normally. My initial guess that it might be a Linux problem doesn't seem to be the case. It only occurs on my main Linux machine. So this bug doesn't seem to be very important and is also a pretty rare use case, so I will close it for now.

Thanks for looking into it though!