Bug 403048

Summary: Freeze in Strokes/Layers jobs [GDB backtrace]
Product: [Applications] krita Reporter: wolthera <griffinvalley>
Component: Layer StackAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: halla, rebecca, scottpetrovic, storm.anthro
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description wolthera 2019-01-09 19:52:12 UTC
SUMMARY
Krita freezes from time to time, not sure what is causing it(it seems to be related with hiding and showing layers), but I do get a backtrace in GDB when sending ctrl+c.

Image is a 300dpi a4 with 8bit and two layers.

-----------------------------------------------------------------------------

Thread 1 "krita" received signal SIGINT, Interrupt.
0x00007ffff0f362fc in KisUpdaterContext::getContextSnapshotEx (this=0x55556811f480) at /home/wolthera/krita/src/libs/image/kis_updater_context.cpp:68
68          Q_FOREACH (const KisUpdateJobItem *item, m_jobs) {
(gdb) thread apply all backtrace

Thread 9 (Thread 0x7fff9aaa3700 (LWP 4425)):
#0  0x00007ffff314bbf9 in __GI___poll (fds=0x7fff8c003ce0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007fffeaf18539 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fffeaf1864c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff3c9e04b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007ffff3c4230a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff3a6dbba in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007ffff3a78adb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007fffec8146db in start_thread (arg=0x7fff9aaa3700) at pthread_create.c:463
#8  0x00007ffff315888f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 8 (Thread 0x7fff9b2a4700 (LWP 4412)):
#0  0x00007ffff314bbf9 in __GI___poll (fds=0x7fff94005440, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007fffeaf18539 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fffeaf1864c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff3c9e02f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007ffff3c4230a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff3a6dbba in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007fffd889d826 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5
#7  0x00007ffff3a78adb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007fffec8146db in start_thread (arg=0x7fff9b2a4700) at pthread_create.c:463
#9  0x00007ffff315888f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 7 (Thread 0x7fffb1caf700 (LWP 4403)):
#0  0x00007ffff314bbf9 in __GI___poll (fds=0x7fff9c004ee0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007fffeaf18539 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fffeaf1864c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff3c9e02f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007ffff3c4230a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff3a6dbba in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007fffd84224f5 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#7  0x00007ffff3a78adb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007fffec8146db in start_thread (arg=0x7fffb1caf700) at pthread_create.c:463
#9  0x00007ffff315888f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 6 (Thread 0x7fffb14ae700 (LWP 4374)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007ffff3a6c870 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#2  0x00007ffff3a6c6e2 in QSemaphore::tryAcquire(int, int) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#3  0x00007ffff0dd6e4c in KisTileDataSwapper::waitForWork (this=0x7ffff15464e0 <(anonymous namespace)::Q_QGS_s_instance::innerFunction()::holder+64>)
    at /home/wolthera/krita/src/libs/image/tiles3/swap/kis_tile_data_swapper.cpp:86
#4  0x00007ffff0dd6e68 in KisTileDataSwapper::run (this=0x7ffff15464e0 <(anonymous namespace)::Q_QGS_s_instance::innerFunction()::holder+64>)
    at /home/wolthera/krita/src/libs/image/tiles3/swap/kis_tile_data_swapper.cpp:92
#5  0x00007ffff3a78adb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007fffec8146db in start_thread (arg=0x7fffb14ae700) at pthread_create.c:463
#7  0x00007ffff315888f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 4 (Thread 0x7fffb4412700 (LWP 4368)):
---Type <return> to continue, or q <return> to quit---
#0  0x00007ffff314bbf9 in __GI___poll (fds=0x7fffac004ae0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007fffeaf18539 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fffeaf1864c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff3c9e02f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007ffff3c4230a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff3a6dbba in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007ffff3a78adb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007fffec8146db in start_thread (arg=0x7fffb4412700) at pthread_create.c:463
#8  0x00007ffff315888f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7fffccb96700 (LWP 4167)):
#0  0x00007ffff314bbf9 in __GI___poll (fds=0x7fffc80192d0, nfds=4, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007fffeaf18539 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fffeaf1864c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff3c9e02f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007ffff3c4230a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff3a6dbba in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007fffeca41e45 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#7  0x00007ffff3a78adb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007fffec8146db in start_thread (arg=0x7fffccb96700) at pthread_create.c:463
#9  0x00007ffff315888f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7fffdbb66700 (LWP 4162)):
#0  0x00007ffff314bbf9 in __GI___poll (fds=0x7fffdbb65c68, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007ffff17a6747 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x00007ffff17a836a in xcb_wait_for_event () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007fffde4d2ed9 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#4  0x00007ffff3a78adb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007fffec8146db in start_thread (arg=0x7fffdbb66700) at pthread_create.c:463
#6  0x00007ffff315888f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7ffff7f81cc0 (LWP 4014)):
#0  0x00007ffff0f362fc in KisUpdaterContext::getContextSnapshotEx (this=0x55556811f480) at /home/wolthera/krita/src/libs/image/kis_updater_context.cpp:68
#1  0x00007ffff0f49fd2 in KisStrokesQueue::processOneJob (this=0x55556811f470, updaterContext=..., externalJobsPending=false)
    at /home/wolthera/krita/src/libs/image/kis_strokes_queue.cpp:673
#2  0x00007ffff0f4936c in KisStrokesQueue::processQueue (this=0x55556811f470, updaterContext=..., externalJobsPending=false)
    at /home/wolthera/krita/src/libs/image/kis_strokes_queue.cpp:539
#3  0x00007ffff0f5633f in KisUpdateScheduler::processQueues (this=0x555568149500) at /home/wolthera/krita/src/libs/image/kis_update_scheduler.cpp:396
#4  0x00007ffff0f56175 in KisUpdateScheduler::barrierLock (this=0x555568149500) at /home/wolthera/krita/src/libs/image/kis_update_scheduler.cpp:373
#5  0x00007ffff0f71b32 in KisImage::barrierLock (this=0x555567360e30, readOnly=false) at /home/wolthera/krita/src/libs/image/kis_image.cc:551
#6  0x00007ffff111d6df in KisLegacyUndoAdapter::addCommand (this=0x555568149460, command=0x55556db541f0) at /home/wolthera/krita/src/libs/image/kis_legacy_undo_adapter.cpp:51

#7  0x00007ffff67fb484 in KisNodeCommandsAdapter::setOpacity (this=0x555564735db0, node=..., opacity=255) at /home/wolthera/krita/src/libs/ui/kis_node_commands_adapter.cpp:92
#8  0x00007ffff68034c3 in KisNodeManager::setNodeOpacity (this=0x55556526a3b8, node=..., opacity=255, finalChange=true) at /home/wolthera/krita/src/libs/ui/kis_node_manager.cpp:770
#9  0x00007ffff6803a2d in KisNodeManager::nodeOpacityChanged (this=0x55556526a3b8, opacity=100, finalChange=true) at /home/wolthera/krita/src/libs/ui/kis_node_manager.cpp:837
#10 0x00007fffb72bd96d in KisLayerBox::slotOpacityChanged (this=0x555567b99e00) at /home/wolthera/krita/src/plugins/dockers/defaultdockers/kis_layer_box.cpp:742
#11 0x00007fffb72c0b2a in KisLayerBox::qt_static_metacall (_o=0x555567b99e00, _c=QMetaObject::InvokeMetaMethod, _id=15, _a=0x7fffffffd950)
    at /home/wolthera/krita/build/plugins/dockers/defaultdockers/kritadefaultdockers_autogen/include/moc_kis_layer_box.cpp:242
#12 0x00007ffff3c73075 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007ffff3c7fe47 in QTimer::timeout(QTimer::QPrivateSignal) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
---Type <return> to continue, or q <return> to quit---
#14 0x00007ffff3c801a8 in QTimer::timerEvent(QTimerEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007ffff3c73b9b in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#16 0x00007ffff49d0e1c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007ffff49d83ef in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007ffff6aebb6f in KisApplication::notify (this=0x7fffffffe0b0, receiver=0x555567b99ec8, event=0x7fffffffdce0) at /home/wolthera/krita/src/libs/ui/KisApplication.cpp:608
#19 0x00007ffff3c43fe8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007ffff3c9d4be in QTimerInfoList::activateTimers() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#21 0x00007ffff3c9dcb9 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#22 0x00007fffeaf18387 in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007fffeaf185c0 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007fffeaf1864c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007ffff3c9e02f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#26 0x00007fffde55e761 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#27 0x00007ffff3c4230a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#28 0x00007ffff3c4b4d0 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#29 0x0000555555e91e57 in main (argc=1, argv=0x7fffffffe218) at /home/wolthera/krita/src/krita/main.cc:459
(gdb) 
(gdb)
Comment 1 Scott Petrovic 2019-01-14 03:22:10 UTC
I spent a while testing this with various commits and I might have a potential commit that is causing this.

Commit: 5f9123
add a createActions method to KoToolFactoryBase (11/28/2018)

When I was testing, I usually had to switch tools a few times to trigger it. Usually between the freehand brush, move, and transform tool. Changing tools and doing something, then clicking some layer visibility icons to test. It eventually triggered after a minute or two.

Going back one more commit, the error seemed to disappear. Maybe someone else can test on that commit to see if that is the culprit.
Comment 2 Rebecca Breu 2019-01-14 20:37:23 UTC
That's also the commit causing this bug:

https://bugs.kde.org/show_bug.cgi?id=401757
Comment 3 Halla Rempt 2019-01-15 11:49:01 UTC
*** Bug 401757 has been marked as a duplicate of this bug. ***
Comment 4 Halla Rempt 2019-01-15 11:50:05 UTC
Simplest way to reproduce until now

* paint
* duplicate layer
* paint
* switch to move tool
---> the outline doesn't get show, so the tool does not get "properly" activated, even though moving works
* switch back to first layer: nothing works until we switch layers again.
Comment 5 Halla Rempt 2019-01-15 13:52:23 UTC
Git commit 0d2f1d16e187a2110e2bf4b21e0d9c23b0871489 by Boudewijn Rempt.
Committed on 15/01/2019 at 13:49.
Pushed by rempt into branch 'master'.

Do not create the move tool option widget twice

Flake first activates a tool, then asks it to create its option
widget(s). However, the move tool needs to have the option widget
created when it's activated, so create the option widget in the
constructor of the move tool.

This also incidentally fixes the problems with actions only being
executed after changing the current node having used the move tool.

M  +32   -42   plugins/tools/basictools/kis_tool_move.cc
M  +0    -2    plugins/tools/basictools/kis_tool_move.h

https://commits.kde.org/krita/0d2f1d16e187a2110e2bf4b21e0d9c23b0871489