Bug 398968 - crash on using move tool during document open
Summary: crash on using move tool during document open
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools/Move (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Appimage Linux
: NOR crash
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-22 21:05 UTC by wkg28406
Modified: 2019-07-31 08:42 UTC (History)
2 users (show)

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


Attachments
gdb backtrace of appimage (13.97 KB, text/x-log)
2018-09-22 21:05 UTC, wkg28406
Details
gdb backtrace of 4.1.3-1 (16.46 KB, text/x-log)
2018-10-09 18:24 UTC, wkg28406
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wkg28406 2018-09-22 21:05:23 UTC
Created attachment 115170 [details]
gdb backtrace of appimage

SUMMARY
krita-4.1.1-5 (Arch Linux)
krita-4.2.0-pre-alpha-127857b-x86_64.appimage

Tested with fresh configuration (removing existing ~/.local/share/krita, ~/.config/krita*)

STEPS TO REPRODUCE
1. Have other .kra files to open (only tested format)
2. Create new document (ctrl+n)
3. Fill canvas with black, Edit > Fill (shift+backspace) you need something for the move tool to easily grab
4. Switch to move tool (t)
5. File > Open (ctrl+o), select another document to open (larger = easier)
6. While file is loading, click repeatedly on canvas of original document

EXPECTED RESULT
Nothing?

ACTUAL RESULT
SIGSEGV

SOFTWARE VERSIONS
KDE Plasma Version: 5.13.5
KDE Frameworks Version: 5.50.0
Qt Version: 5.11.2

ADDITIONAL INFORMATION
May not be related entirely with move tool, that was just the used method of easily reproducing crash.
Seems to depend on size of file opened, the amount of time required/things it has to load.
Happens consistently with 20+ MB .kra files, may vary based on processor.
Comment 1 Halla Rempt 2018-10-09 13:13:26 UTC
Hi,

I'm afraid the backtrace isn't very useful, because there are no debug symbols in there. It is a timing issue and we sort of know what is up: the tool gets confused because the canvas is switched in the middle of it trying to do stuff. It's going to be really hard to fix, though.
Comment 2 wkg28406 2018-10-09 18:24:20 UTC
Created attachment 115524 [details]
gdb backtrace of 4.1.3-1

Sorry, here is one that should have symbols, if it's helpful.

This was produced using the brush tool, so it doesn't seem directly related with move tool, just usage of some tools.
Comment 3 Halla Rempt 2019-05-09 10:23:32 UTC
Backtrace with line numbers:

#6  0x00007f256bad3da8 in KoToolProxy::canvas() const (this=<optimized out>) at /home/boud/dev/krita/libs/flake/KoToolProxy.cpp:158
#7  0x00007f256e8f65c3 in KisToolProxy::widgetToDocument(QPointF const&) const (this=<optimized out>, widgetPoint=...) at /home/boud/dev/krita/libs/ui/canvas/kis_tool_proxy.cpp:48
#8  0x00007f256e8f6f10 in KisToolProxy::forwardEvent(KisToolProxy::ActionState, KisTool::ToolAction, QEvent*, QEvent*) (this=0x2824a930, state=state@entry=KisToolProxy::END, action=action@entry=KisTool::Primary, event=event@entry=0x7ffd4b704350, originalEvent=originalEvent@entry=0x7ffd4b704350) at /home/boud/dev/krita/libs/ui/canvas/kis_tool_proxy.cpp:127
#9  0x00007f256ecb86ce in KisToolInvocationAction::end(QEvent*) (this=0xb40dcd0, event=0x7ffd4b704350) at /home/boud/dev/krita/libs/ui/input/kis_tool_invocation_action.cpp:152
#10 0x00007f256ecc7e8c in KisShortcutMatcher::forceEndRunningShortcut(QPointF const&) (this=<optimized out>, localPos=...) at /home/boud/dev/krita/libs/ui/input/kis_shortcut_matcher.cpp:592
#11 0x00007f256ecc7eff in KisShortcutMatcher::lostFocusEvent(QPointF const&) (this=<optimized out>, localPos=...) at /home/boud/dev/krita/libs/ui/input/kis_shortcut_matcher.cpp:399
#12 0x00007f256eca4a66 in KisInputManager::slotAboutToChangeTool() (this=0xb4f2688) at /home/boud/dev/krita/libs/ui/input/kis_input_manager.cpp:700
#13 0x00007f25645193e5 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib64/libQt5Core.so.5
#14 0x00007f256bac637f in KoToolManager::aboutToChangeTool(KoCanvasController*) (this=<optimized out>, _t1=<optimized out>) at /home/boud/dev/b-krita/libs/flake/kritaflake_autogen/include/moc_KoToolManager.cpp:465
#15 0x00007f256bac6af3 in KoToolManager::Private::disconnectActiveTool() (this=this@entry=0xb3f22c0) at /home/boud/dev/krita/libs/flake/KoToolManager.cpp:523
#16 0x00007f256baca7e0 in KoToolManager::Private::switchCanvasData(CanvasData*) (this=this@entry=0xb3f22c0, cd=0x204ac540) at /home/boud/dev/krita/libs/flake/KoToolManager.cpp:672
#17 0x00007f256bacb493 in KoToolManager::Private::attachCanvas(KoCanvasController*) (this=0xb3f22c0, controller=<optimized out>, controller@entry=0x1ca2d540) at /home/boud/dev/krita/libs/flake/KoToolManager.cpp:763
#18 0x00007f256bacb97d in KoToolManager::addController(KoCanvasController*) (this=0x7f256be7fb30 <_ZZN12_GLOBAL__N_116Q_QGS_s_instance13innerFunctionEvE6holder>, controller=<optimized out>) at /home/boud/dev/krita/libs/flake/KoToolManager.cpp:271
#19 0x00007f256ed92704 in KisView::setViewManager(KisViewManager*) (this=this@entry=0x24e099c0, view=<optimized out>) at /home/boud/dev/krita/libs/ui/KisView.cpp:333
#20 0x00007f256ed63b00 in KisMainWindow::showView(KisView*) (this=0x3a9ee50, imageView=0x24e099c0) at /home/boud/dev/krita/libs/ui/KisMainWindow.cpp:604
#21 0x00007f256ed61295 in KisMainWindow::addView(KisView*) (this=this@entry=0x3a9ee50, view=view@entry=0x24e099c0) at /home/boud/dev/krita/libs/ui/KisMainWindow.cpp:581
#22 0x00007f256ed6140c in KisMainWindow::addViewAndNotifyLoadingCompleted(KisDocument*) (this=this@entry=0x3a9ee50, document=document@entry=0x7f25500125f0) at /home/boud/dev/krita/libs/ui/KisMainWindow.cpp:940
#23 0x00007f256ed619d3 in KisMainWindow::slotLoadCompleted() (this=0x3a9ee50) at /home/boud/dev/krita/libs/ui/KisMainWindow.cpp:962
#24 0x00007f256ed6e706 in KisMainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x3a9ee50, _c=<optimized out>, _id=<optimized out>, _a=0x7ffd4b7049a0) at /home/boud/dev/b-krita/libs/ui/kritaui_autogen/include/moc_KisMainWindow.cpp:333
#25 0x00007f25645193e5 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib64/libQt5Core.so.5
#26 0x00007f256ed44998 in KisDocument::openUrlInternal(QUrl const&) (this=this@entry=0x7f25500125f0, url=...) at /home/boud/dev/krita/libs/ui/KisDocument.cpp:1746
#27 0x00007f256ed44dbf in KisDocument::openUrl(QUrl const&, QFlags<KisDocument::OpenFlag>) (this=0x7f25500125f0, _url=..., flags=...) at /home/boud/dev/krita/libs/ui/KisDocument.cpp:1210
#28 0x00007f256ed6167d in KisMainWindow::openDocumentInternal(QUrl const&, QFlags<KisMainWindow::OpenFlag>) (this=this@entry=0x3a9ee50, url=..., flags=..., flags@entry=...) at /home/boud/dev/krita/libs/ui/KisMainWindow.cpp:902
#29 0x00007f256ed66a8e in KisMainWindow::openDocument(QUrl const&, QFlags<KisMainWindow::OpenFlag>) (this=this@entry=0x3a9ee50, url=..., flags=flags@entry=...) at /home/boud/dev/krita/libs/ui/KisMainWindow.cpp:877
#30 0x00007f256ed66d6b in KisMainWindow::slotFileOpen(bool) (this=0x3a9ee50, isImporting=isImporting@entry=false) at /home/boud/dev/krita/libs/ui/KisMainWindow.cpp:1473
#31 0x00007f256ed6e60f in KisMainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x3a9ee50, _c=<optimized out>, _id=<optimized out>, _a=0x7ffd4b704dc0) at /home/boud/dev/b-krita/libs/ui/kritaui_autogen/include/moc_KisMainWindow.cpp:314
#32 0x00007f25645193e5 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib64/libQt5Core.so.5
#33 0x00007f25655140c2 in QAction::triggered(bool) () at /usr/lib64/libQt5Widgets.so.5
#34 0x00007f25655166dc in QAction::activate(QAction::ActionEvent) () at /usr/lib64/libQt5Widgets.so.5
#35 0x00007f2565517031 in QAction::event(QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#36 0x00007f256551a7fc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#37 0x00007f2565521d60 in QApplication::notify(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#38 0x00007f256ed32dc7 in KisApplication::notify(QObject*, QEvent*) (this=<optimized out>, receiver=0xd40b9e0, event=0x7ffd4b705140) at /home/boud/dev/krita/libs/ui/KisApplication.cpp:639
#39 0x00007f25644e9908 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#40 0x00007f2564af5152 in QShortcutMap::dispatchEvent(QKeyEvent*) () at /usr/lib64/libQt5Gui.so.5
#41 0x00007f2564af521a in QShortcutMap::tryShortcut(QKeyEvent*) () at /usr/lib64/libQt5Gui.so.5
#42 0x00007f2564aa7ff3 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) () at /usr/lib64/libQt5Gui.so.5
#43 0x00007f2564ac6807 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () at /usr/lib64/libQt5Gui.so.5
#44 0x00007f2564acb585 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib64/libQt5Gui.so.5
#45 0x00007f2564aa3deb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Gui.so.5
#46 0x00007f255a51a46a in  () at /usr/lib64/libQt5XcbQpa.so.5
#47 0x00007f255faeae07 in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0
#48 0x00007f255faeb1b0 in  () at /usr/lib64/libglib-2.0.so.0
#49 0x00007f255faeb23c in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
#50 0x00007f256454691f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#51 0x00007f25644e7c3a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#52 0x00007f25644f0d60 in QCoreApplication::exec() () at /usr/lib64/libQt5Core.so.5
#53 0x00000000004072c1 in main(int, char**) (argc=<optimized out>, argv=0x7ffd4b7058b8) at /home/boud/dev/krita/krita/main.cc:546
[Inferior 1 (process 21785) detached]
Comment 4 Dmitry Kazakov 2019-07-30 15:40:46 UTC
The bug is still reproducible after my fixes :(
Comment 5 Dmitry Kazakov 2019-07-30 16:17:08 UTC
Git commit 2c07467638ccbba6b664d7033087d9f42ead9cbc by Dmitry Kazakov.
Committed on 30/07/2019 at 16:16.
Pushed by dkazakov into branch 'master'.

Make sure that the tool action is deactivated/finished exactly for the canvas it was started

When switching canvases (creating new ones), it might happen that the
tool proxy will be switched right in the middle of the stroke. In
such a case we should deactivate/finish the action of the *old* canvas,
not the new one.

M  +18   -9    libs/ui/input/kis_tool_invocation_action.cpp

https://invent.kde.org/kde/krita/commit/2c07467638ccbba6b664d7033087d9f42ead9cbc
Comment 6 Halla Rempt 2019-07-31 08:42:12 UTC
Git commit 09ae9a67adce4deca6e64581b23c0d7637d86cb5 by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 31/07/2019 at 08:39.
Pushed by rempt into branch 'krita/4.2'.

Make sure that the tool action is deactivated/finished exactly for the canvas it was started

When switching canvases (creating new ones), it might happen that the
tool proxy will be switched right in the middle of the stroke. In
such a case we should deactivate/finish the action of the *old* canvas,
not the new one.

M  +18   -9    libs/ui/input/kis_tool_invocation_action.cpp

https://invent.kde.org/kde/krita/commit/09ae9a67adce4deca6e64581b23c0d7637d86cb5