Bug 502266 - Copying and pasting selection to new layer crashes Krita
Summary: Copying and pasting selection to new layer crashes Krita
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: * Unknown (other bugs)
Version First Reported In: 5.2.9
Platform: Manjaro Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
: 509181 (view as bug list)
Depends on:
Blocks:
 
Reported: 2025-04-01 07:27 UTC by Ho Lee Fuk
Modified: 2025-11-28 22:35 UTC (History)
6 users (show)

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


Attachments
GDB dump (short) (142.72 KB, text/plain)
2025-04-28 15:33 UTC, Dave
Details
gdb backtrace for upstream Krita compiled with debug symbols (08.25.2025) (20.75 KB, text/plain)
2025-08-24 19:24 UTC, crock_ranked001
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ho Lee Fuk 2025-04-01 07:27:51 UTC
SUMMARY

Copying and pasting selection to new layer CRASHES Krita.

STEPS TO REPRODUCE
1. Use selection tool to select an area
2. Copy selection with CTRL + C
3. Paste selection as new layer
4. CRASH

OBSERVED RESULT
CRASH

EXPECTED RESULT
NO CRASH

SOFTWARE/OS VERSIONS
Linux: XFCE4 / MANJARO

ADDITIONAL INFORMATION:

Application: Krita (krita), signal: Segmentation fault

[KCrash Handler]
#7  0x000078712ecacc40 in __cxxabiv1::__dynamic_cast (src_ptr=0x5619ee4b8a10, src_type=0x787130d5e5b8 <typeinfo for KisNode>, dst_type=0x787130d5e250 <typeinfo for KisCloneLayer>, src2dst=0) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/dyncast.cc:71
#8  0x0000787131232e2c in ?? () from /usr/lib/libkritaui.so.19
#9  0x00007871312382f7 in KisMimeData::tryLoadInternalNodes(QMimeData const*, KisSharedPtr<KisImage>, KisShapeController*, bool&) () from /usr/lib/libkritaui.so.19
#10 0x000078713123a07f in KisMimeData::loadNodesFast(QMimeData const*, KisSharedPtr<KisImage>, KisShapeController*, bool&) () from /usr/lib/libkritaui.so.19
#11 0x000078713123fa09 in KisMimeData::insertMimeLayers(QMimeData const*, KisSharedPtr<KisImage>, KisShapeController*, KisNodeDummy*, KisNodeDummy*, bool, KisNodeInsertionAdapter*, bool, QPointF, KisProcessingApplicator*) () from /usr/lib/libkritaui.so.19
#12 0x000078713124af81 in KisNodeManager::pasteLayersFromClipboard(bool, QPointF, KisProcessingApplicator*) () from /usr/lib/libkritaui.so.19
#13 0x000078713144bf9d in KisPasteActionFactory::run(QFlags<KisPasteActionFactory::Flag>, KisViewManager*) () from /usr/lib/libkritaui.so.19
#14 0x00007871312aad8b in KisSelectionManager::paste() () from /usr/lib/libkritaui.so.19
#15 0x000078712f2e4ae2 in ?? () from /usr/lib/libQt5Core.so.5
#16 0x000078712ff49305 in QAction::triggered(bool) () from /usr/lib/libQt5Widgets.so.5
#17 0x000078712ff4f030 in QAction::activate(QAction::ActionEvent) () from /usr/lib/libQt5Widgets.so.5
#18 0x000078712ff4f116 in QAction::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#19 0x000078712ff56581 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#20 0x00007871314ae3df in KisApplication::notify(QObject*, QEvent*) () from /usr/lib/libkritaui.so.19
#21 0x000078712f2b0418 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#22 0x000078712f76fce5 in QShortcutMap::dispatchEvent(QKeyEvent*) () from /usr/lib/libQt5Gui.so.5
#23 0x000078712f770285 in QShortcutMap::tryShortcut(QKeyEvent*) () from /usr/lib/libQt5Gui.so.5
#24 0x000078712f71ea32 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) () from /usr/lib/libQt5Gui.so.5
#25 0x000078712f7385e6 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /usr/lib/libQt5Gui.so.5
#26 0x000078712f71d2cd in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5
#27 0x0000787128f2fa98 in ?? () from /usr/lib/libQt5XcbQpa.so.5
#28 0x000078712cb06104 in ?? () from /usr/lib/libglib-2.0.so.0
#29 0x000078712cb69d57 in ?? () from /usr/lib/libglib-2.0.so.0
#30 0x000078712cb05535 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#31 0x000078712f2ff72f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#32 0x000078712f2a80dc in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#33 0x000078712f2b45dd in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
#34 0x00005619eaffe009 in ?? ()
#35 0x000078712ea35488 in ?? () from /usr/lib/libc.so.6
#36 0x000078712ea3554c in __libc_start_main () from /usr/lib/libc.so.6
#37 0x00005619eafffff5 in ?? ()
[Inferior 1 (process 18760) detached]
Sentry is attempting to send 2 pending events
Waiting up to 30 seconds
Press Ctrl-C to quit
Comment 1 Halla Rempt 2025-04-01 07:44:51 UTC
I cannot reproduce this crash with the 5.2.9 appimage.
Comment 2 Ho Lee Fuk 2025-04-22 01:01:59 UTC
(In reply to Halla Rempt from comment #1)
> I cannot reproduce this crash with the 5.2.9 appimage.

Unfortunate. I downloaded the appimage from Krita home page and it crashes too. Here is additional information from console output:

QSocketNotifier: Invalid socket 7 and type 'Read', disabling...
QSocketNotifier: Invalid socket 14 and type 'Read', disabling...
QSocketNotifier: Invalid socket 37 and type 'Read', disabling...
Unable to start Dr. Konqi
Re-raising signal for core dump handling.
SAFE ASSERT (krita): "mimedata" in file /usr/src/debug/krita/krita-5.2.9/libs/ui/kis_clipboard.cc, line 320
19 -- exe=/usr/bin/krita
13 -- platform=xcb
11 -- display=:0
14 -- appname=krita
17 -- apppath=/usr/bin
10 -- signal=11
10 -- pid=43458
17 -- appversion=5.2.9
18 -- programname=Krita
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = krita path = /usr/bin pid = 43458
KCrash: Arguments: /usr/bin/krita 
KCrash: Attempting to start /usr/lib/drkonqi
Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8.
Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
If this causes problems, reconfigure your locale. See the locale(1) manual
for more information.
[1]   Segmentation fault      (core dumped) krita
Comment 3 Ho Lee Fuk 2025-04-22 01:18:58 UTC
Copy & paste works on Krita 4.4.8 appimage.
Comment 4 Dave 2025-04-28 15:33:34 UTC
Created attachment 180738 [details]
GDB dump (short)
Comment 5 Dave 2025-04-28 15:34:13 UTC
Experiencing similar issues on my Arch Linux setup.
Specs:
OS: Arch Linux - Linux-Zen Kernel 6.14.3-zen1-1-zen

CPU: AMD Ryzen 9 9950X 16-Core @ 32x 5.756GHz
GPU: AMD Radeon RX 7900 XTX
RAM: 64GB DDR5 @ 6000Mhz
XFCE 4.20 (X11)

Attaching a GDB backtrace.
Comment 6 joonasempura 2025-05-01 16:46:15 UTC
OS: Arch Linux  6.14.4
Desktop environment: XFCE4 X11  
GPU: Nvidia GTX 1080, driver 570.144  
  
I can confirm that this bug happens in versions 5.1.0 to 5.2.9 linux appimages.  
The crash does not occur in versions  
- krita-5.0.6-x86_64.appimage  
- krita-5.2.10-prealpha-8459ccdbeb-x86_64.AppImage  
  
I (kaelygon) and couple others have been discussing about the same issue on this thread: https://krita-artists.org/t/krita-5-2-9-crash-when-copy-pasting-any-image-on-arch-linux/118953  
5.1.0 Introduced ability to cut a selection of all the child layers when a Group is highlighted in Layers, which could be causing the issue.  
  
The crash only happens on X11. I could not reproduce the bug on LXQt+Wayfire Wayland  
  
Console output:  
```text
$ '/home/campus/Downloads/krita-5.2.9-x86_64.AppImage' 
QObject::startTimer: Timers cannot have negative intervals
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
/tmp/.mount_krita-lRrpK7/usr/lib/krita-python-libs/krita added to PYTHONPATH
Warning: requested data for unknown action "path-break-at-selection"
krita.general: Unexpected tool event has come to endStroke while being mode 0 !
krita.general: Unexpected tool event has come to endStroke while being mode 0 !
SAFE ASSERT (krita): "mimedata" in file /builds/graphics/krita/libs/ui/kis_clipboard.cc, line 320
krita.general: Unexpected tool event has come to endStroke while being mode 0 !
Segmentation fault (core dumped)
```  
  
~/.local/share/krita.log  
```text
================================================================================
SESSION: 01 May 2025 19:29:26 +0300. Executing /tmp/.mount_krita-lRrpK7/usr/bin/krita

Krita Version: 5.2.9 (git ac6cae8), Qt version compiled: 5.15.7, loaded: 5.15.7. Process ID: 16441
-- -- -- -- -- -- -- --
01 May 2025 19:29:26 +0300: Style: fusion. Available styles: Windows, Fusion
01 May 2025 19:29:26 +0300: Database is up to date. Version: 0.0.17, created by Krita 5.2.10-prealpha, at Thu May 1 19:20:53 2025
01 May 2025 19:29:30 +0300: Importing application/x-krita to application/x-krita. Location: /home/campus/Art/rivulet.kra. Real location: /home/campus/Art/rivulet.kra. Batchmode: 0
01 May 2025 19:29:30 +0300: Loaded image from application/x-krita. Size: 1024 * 1024 pixels, 4.16667 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 3
01 May 2025 19:29:37 +0300: SAFE ASSERT (krita): "mimedata" in file /builds/graphics/krita/libs/ui/kis_clipboard.cc, line 320
```  
  
~/.local/share/krita-sysinfo.log : https://pastebin.com/iQ0biUiF
Comment 7 joonasempura 2025-05-01 17:07:53 UTC
Correction to my last comment
The bug still occurs in krita-5.2.10-prealpha, but the crash doesn't happen every time.  
I closed Krita and tried after a little while, and I could reproduce the bug again
Comment 8 mikel 2025-06-07 12:57:14 UTC
Same thing happening to me, let me know if you need any dump information (although I see the same assert as everyone else, including line number).

Krita: 5.2.9 (official arch linux package)

OS: Arch linux 6.14.9-arch1-1 x86_64
CPU: AMD Ryzen 9 7900X 12-core
GPU: NVIDIA GeForce RTX 4070 Ti SUPER
RAM: 64GB 
DE: XFCE 4.20 (X11)

NOTE: commenting on the bug report because I don't see any "subscribe"/"vote up" button and I want to be notified -and I REALLY don't want to stop using xfce, and copy/paste is kind of important...-
Comment 9 Halla Rempt 2025-06-07 15:03:23 UTC
Okay, it turns out I actually had fixed that issue two months ago, and the fix will be in the next bugfix release. But I'm not sure why safe asserts actually stop Krita in the appimage, because those should be disabled in release builds.

commit 70ef3defac6ef3875e8be74d3956080a281a0666
Author: Halla Rempt <halla@valdyas.org>, Fri Mar 28 11:31:39 2025 +0100 (2 months ago)
Committer: Halla Rempt <halla@valdyas.org>, Fri Mar 28 11:32:30 2025 +0100 (2 months ago)
Branches: <Expand>
Follows: v5.3.0-prealpha-deleteme

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.

BUG:501560
Comment 10 crock_ranked001 2025-08-24 19:24:40 UTC
Created attachment 184407 [details]
gdb backtrace for upstream Krita compiled with debug symbols (08.25.2025)

Experiencing same issues on my Debian installation several months later.
Observed in:
Official 5.2.11 Release AppImage
5.2.11 Plus Weekly from krita.org
5.3.0 Nightly
Weekly debug build from the GitLab repo
Compiled upstream source in debug mode as of 08.24.2025

OS: Debian 13 Trixie / Linux 6.12.41+deb13-amd64
DE: XFCE 4.20 (X11)
CPU: AMD Ryzen 5 5600H with Radeon Graphics
GPU: Cezanne [Radeon Vega Series / Radeon Vega Mobile Series]
RAM: 16 GB DDR4 3200MHz
Comment 11 crock_ranked001 2025-08-25 10:21:03 UTC
(In reply to crock_ranked001 from comment #10)
> Created attachment 184407 [details]
> gdb backtrace for upstream Krita compiled with debug symbols (08.25.2025)
> 
> Experiencing same issues on my Debian installation several months later.
> Observed in:
> Official 5.2.11 Release AppImage
> 5.2.11 Plus Weekly from krita.org
> 5.3.0 Nightly
> Weekly debug build from the GitLab repo
> Compiled upstream source in debug mode as of 08.24.2025
> 
> OS: Debian 13 Trixie / Linux 6.12.41+deb13-amd64
> DE: XFCE 4.20 (X11)
> CPU: AMD Ryzen 5 5600H with Radeon Graphics
> GPU: Cezanne [Radeon Vega Series / Radeon Vega Mobile Series]
> RAM: 16 GB DDR4 3200MHz

A little update, I tried on LXQt 2.1.0 and didn't observe such behavior, I wonder what Xfce 4.20 does differently... 
I also tried different clipboard managers and they don't seem to be the cause of this.
Notably, I don't recall crashes on Xfce 4.18, since it didn't crash with 5.2.6 (it does with 4.20). Seems like a regression on their side.
Comment 12 crock_ranked001 2025-08-26 21:09:29 UTC
I'll close this one since I found more info that I think is unrelated to this issue.
Comment 13 mallock 2025-09-06 06:38:23 UTC
*** Bug 509181 has been marked as a duplicate of this bug. ***
Comment 14 joonasempura 2025-10-23 22:50:59 UTC
Thanks to crock_ranked001's comment, I found a workaround for anyone who's still using xfce 4.20 with x11

You only have to downgrade xfce4-settings to 4.18.6

This bug can remain closed since this is most certainly xfce issue
Comment 15 mikel 2025-11-25 22:52:40 UTC
Hi!

since this was closed here pointing to XFCE as culprit and didn't find any bug there, I just opened one, in case any of the people affected wants to check that I didn't say anything wrong (and you are interested) and to avoid double reporting bugs there (in case someone was getting the idea)

https://gitlab.xfce.org/xfce/xfce4-settings/-/issues/623

Many thanks!