Bug 490636 - krita 5.2.3 seg faults when trying to paste a pic that was copied from another Krita tab
Summary: krita 5.2.3 seg faults when trying to paste a pic that was copied from anothe...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Usability (show other bugs)
Version: 5.2.3-beta1
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
: 490995 491408 491414 491418 491793 491877 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-07-22 05:59 UTC by Ralf
Modified: 2024-08-19 19:36 UTC (History)
8 users (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 Ralf 2024-07-22 05:59:20 UTC
Hi,

krita 5.2.3-1 seg faults each time I try to copy and paste a pic from one Krita tab to another. The seg fault happens a little bit delayed shortly after pushing Ctrl+V or using the paste option of the menu. The last time I used Krita for exactly the same work but without this issue was 2024-05-12, so that time I used 5.2.2-9.  IOW between 2024-05-12 and 2024-07-21 something changed.

The GNU Debugger output is posted at
https://gitlab.archlinux.org/archlinux/packaging/packages/krita/-/issues/4 .

• rocketmouse@archlinux ~ 
$ lsb_release -dr
Description:	Arch Linux
Release:	rolling
• rocketmouse@archlinux ~ 
$ grep \ Driver /etc/X11/xorg.conf
        Driver     "modesetting"
• rocketmouse@archlinux ~ 
$ pacman -Q krita 
krita 5.2.3-1
• rocketmouse@archlinux ~ 
$ wmctrl -m
Name: Openbox
Class: 
PID: N/A
Window manager's "showing the desktop" mode: OFF

Regards,
Ralf
Comment 1 Ralf 2024-07-22 06:07:10 UTC
$ pacman -Q xf86-video-intel
xf86-video-intel 1:2.99.917+923+gb74b67f0-2
Comment 2 Ralf 2024-07-23 05:32:59 UTC
I have created a package for your appimage and I'm encountering the same problem when using the appimage.
Inserting an image results in a seg fault.

• rocketmouse@archlinux /mnt/winos10/share/.archive/krita 
$ krita ipad2+pro_1228x5_921x3_2024-07-20.kra 
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_kritadktvTy/usr/lib/krita-python-libs/krita added to PYTHONPATH
Segmentation fault (core dumped)
• rocketmouse@archlinux /mnt/winos10/share/.archive/krita 
$ pacman -Qi krita | head -8
Name            : krit
Version         : 5.2.3-1.3
Description     : Edit and paint images with the Krita Appimage
Architecture    : x86_64
URL             : https://krita.org
Licenses        : GPL3
Groups          : None
Provides        : kritaI have created a package for your appimage and I'm encountering the same problem when using the appimage.
Inserting an image results in a seg error.

• rocketmouse@archlinux /mnt/winos10/share/.archive/krita 
$ krita ipad2+pro_1228x5_921x3_2024-07-20.kra 
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_kritadktvTy/usr/lib/krita-python-libs/krita added to PYTHONPATH
Segmentation fault (core dumped)
• rocketmouse@archlinux /mnt/winos10/share/.archive/krita 
$ pacman -Qi krita | head -8
Name            : krit
Version         : 5.2.3-1.3
Description     : Edit and paint images with the Krita Appimage
Architecture    : x86_64
URL             : https://krita.org
Licenses        : GPL3
Groups          : None
Provides        : krita
Comment 3 Ralf 2024-07-23 05:41:59 UTC
"Inserting an image results in a seg fault" should read "Pasting an image results in a seg fault". My apologies for the duplicated text by Comment 2. Is it possible to edit comments? I don't see an option to do so.
Comment 4 Dmitry Kazakov 2024-07-23 12:48:01 UTC
I cannot reproduce this issue on Windows. It seems like it is something linux-specific.

Ralf, could you tell, do you use X11 or Wayland?
Comment 5 Ralf 2024-07-23 13:12:56 UTC
Hi Dmitry,

I'm still a X user. 

From comment 1:
$ grep \ Driver /etc/X11/xorg.conf
        Driver     "modesetting"

A copy of comment 2:
$ pacman -Q xf86-video-intel
xf86-video-intel 1:2.99.917+923+gb74b67f0-2

And FWIW additional info. CPU with integrated GPU:
$ hwinfo --cpu | grep Model | sort -u
  Model: 6.191.5 "13th Gen Intel(R) Core(TM) i3-13100"

Kernel:
$ uname -r
6.10.0-arch1-1

Kernel parameters:
$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-linux root=/dev/disk/by-label/m1.archlinux ro threadirqs ibt=off

Regards,
Ralf
Comment 6 Halla Rempt 2024-07-24 08:16:55 UTC
I can reproduce this with the 5.2.3 appimage. I also see

krita(3726868)/(default) kis_assert_common: SAFE ASSERT (krita): "!nodes.isEmpty()" in file /home/halla/dev/5.2/libs/image/kis_layer_utils.cpp, line 1599

And lots of

krita(3727282)/(krita.general) KisToolRectangleBase::endStroke: Unexpected tool event has come to endStroke while being mode 0 !
krita(3727282)/(krita.general) KisToolRectangleBase::endStroke: Unexpected tool event has come to endStroke while being mode 0 !

I cannot reproduce the crash in gdb, though, so I don't have a backtrace.

ctrl-a; ctrl-c; ctrl-tab; ctrl-v doesn't paste anything, even though the paste is enabled.

(Oh, and trying to right-click in the layerbox to paste the clipboard doesn't toggle the menu unless I click on an existing layer.)
Comment 7 Ralek Kolemios 2024-07-30 01:02:35 UTC
*** Bug 490995 has been marked as a duplicate of this bug. ***
Comment 8 Ralek Kolemios 2024-07-30 01:15:10 UTC
As Freya pointed out on the forums, this seems to be related to bug #490843. Trying to paste Krita layer contents into a document with no actively selected layer leads to the segfault.
I can consistently get the crash so long as I can get to a state with no active layer selected (by switching tabs)
The crash never happens so long as I ensure a layer is selected before pasting.
Comment 9 Dmitry Kazakov 2024-07-31 08:47:31 UTC
Thanks Freya and Ralek!

I can confirm that this bug has the same cause as bug 490843 and is fixed with its fix.

*** This bug has been marked as a duplicate of bug 490843 ***
Comment 10 Dmitry Kazakov 2024-07-31 09:10:23 UTC
Git commit 0e0bcc3c614220f96747fd30bbc099afaee88291 by Dmitry Kazakov.
Committed on 31/07/2024 at 09:09.
Pushed by dkazakov into branch 'master'.

Make clip-pasting code a bit more robust

We should check if the active layer is actually non-null when pasting
a mime-data. It is possible that no layer is selected, but it we still
shouldn't crash because of that.

M  +4    -2    libs/ui/kis_mimedata.cpp
M  +1    -1    libs/ui/kis_node_manager.cpp

https://invent.kde.org/graphics/krita/-/commit/0e0bcc3c614220f96747fd30bbc099afaee88291
Comment 11 Dmitry Kazakov 2024-07-31 09:11:39 UTC
Git commit bd541c7c28c1e96aff466cc5c691d0e2014d2094 by Dmitry Kazakov.
Committed on 31/07/2024 at 09:11.
Pushed by dkazakov into branch 'krita/5.2'.

Make clip-pasting code a bit more robust

We should check if the active layer is actually non-null when pasting
a mime-data. It is possible that no layer is selected, but it we still
shouldn't crash because of that.

M  +4    -2    libs/ui/kis_mimedata.cpp
M  +1    -1    libs/ui/kis_node_manager.cpp

https://invent.kde.org/graphics/krita/-/commit/bd541c7c28c1e96aff466cc5c691d0e2014d2094
Comment 12 Freya Lupen 2024-08-08 20:06:44 UTC
*** Bug 491408 has been marked as a duplicate of this bug. ***
Comment 13 Freya Lupen 2024-08-08 20:06:50 UTC
*** Bug 491414 has been marked as a duplicate of this bug. ***
Comment 14 Freya Lupen 2024-08-08 20:06:56 UTC
*** Bug 491418 has been marked as a duplicate of this bug. ***
Comment 15 Freya Lupen 2024-08-16 20:23:14 UTC
*** Bug 491793 has been marked as a duplicate of this bug. ***
Comment 16 Freya Lupen 2024-08-19 19:36:59 UTC
*** Bug 491877 has been marked as a duplicate of this bug. ***