Bug 501560

Summary: [Safe Assert] Copy Krita's Content from Its Own Canvas and Paste Cause A Safe Assert Warning or Freeze (5.3.0-be5a553909)
Product: [Applications] krita Reporter: Protoniv <ss93078>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version First Reported In: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: gdb output from terminal

Description Protoniv 2025-03-16 03:05:46 UTC
Created attachment 179442 [details]
gdb output from terminal

SUMMARY

Copy content from a layer and paste, a safe assert warning appears:
```
Krita has encountered an internal error:
SAFE ASSERT (krita): "mimedata" in file /builds/graphics/krita/libs/ui/kis_clipboard.cc, line 320
Please report a bug to developers!
Press Ignore to try to continue.
Press Abort to see developers information (all unsaved data will be lost)
```
Ignore it will not crash or freeze, but after repeating 2 or 3 times (copy -> paste -> ignore warning), krita will freeze.

krita-5.3.0-prealpha-be5a553909-x86_64.appimage (debug build)


STEPS TO REPRODUCE
1. New file, draw something on canvas, and press keyboard Ctrl+C, then Ctrl+V
2. Safe Assert Warning appears
3. Ignore, Ctrl+C, Ctrl+V, Ignore...repeat
4. Krita freeze

SOFTWARE/OS VERSIONS

Operating System: openSUSE Tumbleweed 20250313
KDE Plasma Version: 6.3.3
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.13.6-1-default (64-bit)
Graphics Platform: X11

ADDITIONAL INFORMATION
Comment 1 Halla Rempt 2025-03-28 10:32:46 UTC
Git commit 70ef3defac6ef3875e8be74d3956080a281a0666 by Halla Rempt.
Committed on 28/03/2025 at 10:32.
Pushed by rempt into branch 'master'.

Replace faulty assert with conditional return

Not having mimedata here is not a coding error or something that
should be fixed when it happens, it's a normal thing to happen
with clipboards.

M  +2    -2    libs/ui/kis_clipboard.cc

https://invent.kde.org/graphics/krita/-/commit/70ef3defac6ef3875e8be74d3956080a281a0666
Comment 2 Halla Rempt 2025-06-07 15:02:36 UTC
Git commit 73b781424d3e4734e82032616efcd31a795350a8 by Halla Rempt.
Committed on 07/06/2025 at 15:02.
Pushed by rempt into branch 'krita/5.2'.

Replace faulty assert with conditional return

Not having mimedata here is not a coding error or something that
should be fixed when it happens, it's a normal thing to happen
with clipboards.
(cherry picked from commit 70ef3defac6ef3875e8be74d3956080a281a0666)

M  +2    -2    libs/ui/kis_clipboard.cc

https://invent.kde.org/graphics/krita/-/commit/73b781424d3e4734e82032616efcd31a795350a8