Bug 433633

Summary: Krita crashed when moving a selection created with magnetic selection tool
Product: [Applications] krita Reporter: Joshua Phelps <jhphelps>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: ahab.greybeard
Priority: NOR Keywords: drkonqi
Version: 4.4.2   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:

Description Joshua Phelps 2021-02-26 05:52:30 UTC
Application: krita (4.4.2)

Qt Version: 5.15.2
Frameworks Version: 5.79.0
Operating System: Linux 5.4.0-66-generic x86_64
Windowing System: X11
Drkonqi Version: 5.21.1
Distribution: KDE neon User Edition 5.21

-- Information about the crash:
SUMMARY
Krita crashes when attempting to move a selection that was created with the magnetic selection tool

STEPS TO REPRODUCE
1. Create selection using magnetic selection tool
2. Click edge of selection and attempt to drag somewhere else

OBSERVED RESULT
Krita immediately crashes when dragging selection

EXPECTED RESULT
Selection is moved with cursor to new area of image

The crash can be reproduced every time.

-- Backtrace:
Application: Krita (krita), signal: Segmentation fault

[New LWP 7685]
[New LWP 7686]
[New LWP 7687]
[New LWP 7688]
[New LWP 7689]
[New LWP 7699]
[New LWP 7700]
[New LWP 7703]
[New LWP 7704]
[New LWP 7705]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f157c50aaff in __GI___poll (fds=0x7ffcabf5ae68, nfds=1, timeout=1000) at ../sysdeps/unix/sysv/linux/poll.c:29
[Current thread is 1 (Thread 0x7f15774cc680 (LWP 7667))]

Thread 11 (Thread 0x7f1513fff700 (LWP 7705)):
#0  __GI___libc_read (nbytes=16, buf=0x7f1513ffead0, fd=38) at ../sysdeps/unix/sysv/linux/read.c:26
#1  __GI___libc_read (fd=38, buf=0x7f1513ffead0, nbytes=16) at ../sysdeps/unix/sysv/linux/read.c:24
#2  0x00007f1579f3a89f in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f1579ef1cde in g_main_context_check () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f1579ef2132 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f1579ef22c3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#6  0x00007f157caf0fbb in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007f157ca951ab in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007f157c8afa12 in QThread::exec() () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x00007f156944238a in ?? () from /lib/x86_64-linux-gnu/libQt5Quick.so.5
#10 0x00007f157c8b0bac in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#11 0x00007f157a7be609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#12 0x00007f157c517293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 10 (Thread 0x7f151ffff700 (LWP 7704)):
#0  0x00007f1579f3f24d in g_mutex_lock () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007f1579ef1214 in g_main_context_acquire () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f1579ef2045 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f1579ef22c3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f157caf0fbb in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007f157ca951ab in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007f157c8afa12 in QThread::exec() () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007f156918cfa9 in ?? () from /lib/x86_64-linux-gnu/libQt5Qml.so.5
#8  0x00007f157c8b0bac in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x00007f157a7be609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#10 0x00007f157c517293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 9 (Thread 0x7f151f7fe700 (LWP 7703)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f157c8b3130 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#2  0x00007f157c8b2f96 in QSemaphore::tryAcquire(int, int) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#3  0x00007f157deba857 in KisTileDataSwapper::waitForWork (this=<optimized out>) at ./libs/image/tiles3/swap/kis_tile_data_swapper.cpp:86
#4  0x00007f157debaa3a in KisTileDataSwapper::run (this=0x7f157e221120 <(anonymous namespace)::Q_QGS_s_instance::innerFunction()::holder+64>) at ./libs/image/tiles3/swap/kis_tile_data_swapper.cpp:92
#5  0x00007f157c8b0bac in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007f157a7be609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#7  0x00007f157c517293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 8 (Thread 0x7f1536526700 (LWP 7700)):
#0  0x00007f157c50aaff in __GI___poll (fds=0x7f1524004a60, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f1579ef218e in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f1579ef22c3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f157caf0fbb in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007f157ca951ab in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007f157c8afa12 in QThread::exec() () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007f157c8b0bac in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007f157a7be609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#8  0x00007f157c517293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 7 (Thread 0x7f1536ffd700 (LWP 7699)):
#0  0x00007f1579ef1ad4 in g_main_context_check () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007f1579ef2132 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f1579ef22c3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f157caf0fbb in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007f157ca951ab in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007f157c8afa12 in QThread::exec() () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007f157c8b0bac in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007f157a7be609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#8  0x00007f157c517293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 6 (Thread 0x7f1563f45700 (LWP 7689)):
#0  0x00007f1579ef1ae8 in g_main_context_check () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007f1579ef2132 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f1579ef22c3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f157caf0fbb in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007f157ca951ab in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007f157c8afa12 in QThread::exec() () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007f157a7f2f4b in ?? () from /lib/x86_64-linux-gnu/libQt5DBus.so.5
#7  0x00007f157c8b0bac in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007f157a7be609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#9  0x00007f157c517293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 5 (Thread 0x7f15688e3700 (LWP 7688)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f1554001ad8) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f1554001a88, cond=0x7f1554001ab0) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=0x7f1554001ab0, mutex=0x7f1554001a88) at pthread_cond_wait.c:638
#3  0x00007f15748c6b5b in ?? () from /usr/lib/x86_64-linux-gnu/dri/iris_dri.so
#4  0x00007f15748c675b in ?? () from /usr/lib/x86_64-linux-gnu/dri/iris_dri.so
#5  0x00007f157a7be609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#6  0x00007f157c517293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 4 (Thread 0x7f156b05b700 (LWP 7687)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f1554001ad8) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f1554001a88, cond=0x7f1554001ab0) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=0x7f1554001ab0, mutex=0x7f1554001a88) at pthread_cond_wait.c:638
#3  0x00007f15748c6b5b in ?? () from /usr/lib/x86_64-linux-gnu/dri/iris_dri.so
#4  0x00007f15748c675b in ?? () from /usr/lib/x86_64-linux-gnu/dri/iris_dri.so
#5  0x00007f157a7be609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#6  0x00007f157c517293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7f156a85a700 (LWP 7686)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f1554001ad8) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f1554001a88, cond=0x7f1554001ab0) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=0x7f1554001ab0, mutex=0x7f1554001a88) at pthread_cond_wait.c:638
#3  0x00007f15748c6b5b in ?? () from /usr/lib/x86_64-linux-gnu/dri/iris_dri.so
#4  0x00007f15748c675b in ?? () from /usr/lib/x86_64-linux-gnu/dri/iris_dri.so
#5  0x00007f157a7be609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#6  0x00007f157c517293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7f1562059700 (LWP 7685)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f1554001ad8) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f1554001a88, cond=0x7f1554001ab0) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=0x7f1554001ab0, mutex=0x7f1554001a88) at pthread_cond_wait.c:638
#3  0x00007f15748c6b5b in ?? () from /usr/lib/x86_64-linux-gnu/dri/iris_dri.so
#4  0x00007f15748c675b in ?? () from /usr/lib/x86_64-linux-gnu/dri/iris_dri.so
#5  0x00007f157a7be609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#6  0x00007f157c517293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7f15774cc680 (LWP 7667)):
[KCrash Handler]
#4  std::__atomic_base<int>::load (__m=std::memory_order_relaxed, this=0x18) at /usr/include/c++/9/bits/atomic_base.h:413
#5  QAtomicOps<int>::loadRelaxed<int> (_q_value=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qatomic_cxx11.h:239
#6  QBasicAtomicInteger<int>::loadRelaxed (this=0x18) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qbasicatomic.h:107
#7  QtPrivate::RefCount::deref (this=0x18) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qrefcount.h:66
#8  QVector<QPointF>::~QVector (this=<synthetic pointer>, __in_chrg=<optimized out>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h:73
#9  QVector<QPointF>::operator= (other=..., this=0x7f1554008d30) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h:77
#10 KisToolSelectMagnetic::updateSelectedAnchor (this=0x55c5d632bd40) at ./plugins/tools/selectiontools/KisToolSelectMagnetic.cc:431
#11 0x00007f15539fd93d in KisToolSelectMagnetic::endPrimaryAction (this=0x55c5d632bd40, event=0x7ffcabf5b870) at ./plugins/tools/selectiontools/KisToolSelectMagnetic.cc:331
#12 0x00007f157edd0704 in KisToolProxy::forwardToTool (this=<optimized out>, state=KisToolProxy::END, action=KisTool::Primary, event=0x7ffcabf5bfc0, docPoint=...) at ./libs/ui/canvas/kis_tool_proxy.cpp:203
#13 0x00007f157edd0860 in KisToolProxy::forwardEvent (this=0x55c5d62eaa80, state=state@entry=KisToolProxy::END, action=action@entry=KisTool::Primary, event=event@entry=0x7ffcabf5bfc0, originalEvent=originalEvent@entry=0x7ffcabf5bfc0) at ./libs/ui/canvas/kis_tool_proxy.cpp:133
#14 0x00007f157f102d9d in KisToolInvocationAction::end (this=0x55c5d40ffb10, event=0x7ffcabf5bfc0) at /usr/include/c++/9/bits/atomic_base.h:413
#15 0x00007f157f10e307 in KisShortcutMatcher::tryEndRunningShortcut (this=this@entry=0x55c5d3bdf0d0, button=<optimized out>, event=event@entry=0x7ffcabf5bfc0) at ./libs/ui/input/kis_shortcut_matcher.cpp:709
#16 0x00007f157f10f1d6 in KisShortcutMatcher::buttonReleased (this=0x55c5d3bdf0d0, button=<optimized out>, event=event@entry=0x7ffcabf5bfc0) at ./libs/ui/input/kis_shortcut_matcher.cpp:300
#17 0x00007f157f0f121a in KisInputManager::eventFilterImpl (this=0x55c5d3d09c08, event=0x7ffcabf5bfc0) at /usr/include/x86_64-linux-gnu/qt5/QtGui/qevent.h:132
#18 0x00007f157ca96403 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007f157d56ddb2 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#20 0x00007f157d576e77 in QApplication::notify(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00007f157f192afd in KisApplication::notify (this=<optimized out>, receiver=0x55c5cbcaf380, event=0x7ffcabf5bfc0) at ./libs/ui/KisApplication.cpp:713
#22 0x00007f157ca9669a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#23 0x00007f157d5760a7 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007f157d5cbe54 in ?? () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#25 0x00007f157d5cf174 in ?? () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#26 0x00007f157d56ddc3 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#27 0x00007f157d576bb8 in QApplication::notify(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#28 0x00007f157f192afd in KisApplication::notify (this=<optimized out>, receiver=0x55c5d3ddeaa0, event=0x7ffcabf5c4c0) at ./libs/ui/KisApplication.cpp:713
#29 0x00007f157ca9669a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#30 0x00007f157ce784e8 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#31 0x00007f157ce79b55 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#32 0x00007f157ce517ac in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#33 0x00007f1576dfcd7e in ?? () from /lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#34 0x00007f1579ef1f9d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#35 0x00007f1579ef2220 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#36 0x00007f1579ef22c3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#37 0x00007f157caf0fa2 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#38 0x00007f157ca951ab in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#39 0x00007f157ca9d354 in QCoreApplication::exec() () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#40 0x000055c5c7e5fed7 in main (argc=<optimized out>, argv=0x7ffcabf5cb88) at ./krita/main.cc:662
[Inferior 1 (process 7667) detached]

Possible duplicates by query: bug 433252, bug 429420, bug 427021, bug 426384, bug 425205.

Reported using DrKonqi
Comment 1 Ahab Greybeard 2021-02-28 22:43:31 UTC
I can replicate this using Debian 10 with the 4.4.2 appimage.
The double headed arrow cursor appears and has no effect but can be moved around. That cursor remains and nothing can be done at all apart from moving that cursor.

After about 20 seconds, there is a crash. The terminal says "Segmentation fault".

The 4.3.0 appimage also crashes, as do the Feb 28 4.4.4-alpha (git 8dba976) and the Feb 28 5.0.0-prealpha (git f4b012) appimages.
Comment 2 Ahab Greybeard 2021-03-11 05:13:09 UTC
There is an interesting 'workaround' for this.

If you use the magnetic selection tool to create the selection and then select the rectangular (or other) selection tool, you can then move the selection with no problem.
Comment 3 Dmitry Kazakov 2021-08-02 08:49:00 UTC
Git commit bebecb0acb94bb6ecdb932b6d5e425e00141f827 by Dmitry Kazakov.
Committed on 02/08/2021 at 08:48.
Pushed by dkazakov into branch 'master'.

Fix moving selection with the magnetic selection tool

M  +16   -2    plugins/tools/selectiontools/KisToolSelectMagnetic.cc

https://invent.kde.org/graphics/krita/commit/bebecb0acb94bb6ecdb932b6d5e425e00141f827
Comment 4 Dmitry Kazakov 2021-08-03 10:09:31 UTC
Git commit 532050086b9ea64f4457fcf8516eb4f23931be3d by Dmitry Kazakov.
Committed on 03/08/2021 at 08:37.
Pushed by dkazakov into branch 'krita/4.3'.

Fix moving selection with the magnetic selection tool

M  +16   -2    plugins/tools/selectiontools/KisToolSelectMagnetic.cc

https://invent.kde.org/graphics/krita/commit/532050086b9ea64f4457fcf8516eb4f23931be3d