Bug 413601 - Assert/crash with Magnetic Selection tool
Summary: Assert/crash with Magnetic Selection tool
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools/Selection (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Kuntal Majumder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-29 17:46 UTC by Scott Petrovic
Modified: 2020-05-04 09:34 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Petrovic 2019-10-29 17:46:47 UTC
I am getting quite a few crashes/asserts with this tool. I am not sure if it is related to the tool, or something with the tile hash table.

I am on a nightly build from yesterday on a Windows 10 64-bit machine. (git 9a8f3bc)

Right now the "ASSERT(krita)" I get the most frequently says this in the dialog...

krita/libs/image/tiles3/kis_tile_has_table2.h: line 133


STEPS TO REPRODUCE
1. Make a selection with the magnetic selection tool.  
2. Try to make another selection and try to do things like go outside the canvas or double click.

OBSERVED RESULT
Eventually get a crash or the assert mentioned above. I can usually get a crash within a minute of using it.

EXPECTED RESULT
No crash or assert.


SOFTWARE/OS VERSIONS
Windows: 10
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Scott Petrovic 2019-11-05 13:07:44 UTC
Here is another more detailed back trace. This might be a different crash than the first one... 

Thread 1 "krita" received signal SIGSEGV, Segmentation fault.
__memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:540
540	../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
(gdb) bt
#0  0x00007ffff463af3d in __memmove_avx_unaligned_erms ()
    at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:540
#1  0x00007fffe4155c51 in memmove (__len=<optimized out>, __src=<optimized out>, __dest=<optimized out>)
    at /usr/include/x86_64-linux-gnu/bits/string_fortified.h:40
#2  0x00007fffe4155c51 in QVector<QVector<QPointF> >::insert(QTypedArrayData<QVector<QPointF> >::iterator, int, QVector<QPointF> const&) (t=..., n=1, before=..., this=0x5555574d61b0)
    at /usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h:755
#3  0x00007fffe4155c51 in QVector<QVector<QPointF> >::insert(int, QVector<QPointF> const&)
    (t=..., i=<optimized out>, this=0x5555574d61b0)
    at /usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h:442
#4  0x00007fffe4155c51 in KisToolSelectMagnetic::beginPrimaryDoubleClickAction(KoPointerEvent*)
    (this=0x5555574d6060, event=<optimized out>)
    at /home/scott/git/krita/src/plugins/tools/selectiontools/KisToolSelectMagnetic.cc:281
#5  0x00007ffff6d2600e in KisToolProxy::forwardToTool(KisToolProxy::ActionState, KisTool::ToolAction, QEvent*, QPointF const&)
    (this=<optimized out>, state=KisToolProxy::BEGIN, action=KisTool::Primary, event=0x7fffffffd490, docPoint=...) at /home/scott/git/krita/src/libs/ui/canvas/kis_tool_proxy.cpp:181
#6  0x00007ffff6d260e0 in KisToolProxy::forwardEvent(KisToolProxy::ActionState, KisTool::ToolAction, QEvent*, QEvent*)
    (this=0x55555a175df0, state=state@entry=KisToolProxy::BEGIN, action=action@entry=KisTool::Primary, event=event@entry=0x7fffffffd490, originalEvent=originalEvent@entry=0x7fffffffd490)
    at /home/scott/git/krita/src/libs/ui/canvas/kis_tool_proxy.cpp:132
#7  0x00007ffff703cf60 in KisToolInvocationAction::begin(int, QEvent*)
    (this=this@entry=0x55555f0427c0, shortcut=<optimized out>, event=event@entry=0x7fffffffd490)
    at /usr/include/c++/9/bits/atomic_base.h:413
#8  0x00007ffff7048c46 in KisShortcutMatcher::tryRunReadyShortcut(Qt::MouseButton, QEvent*)
Comment 2 Scott Petrovic 2019-11-05 13:17:03 UTC
Here is a separate crash that is happening with a back trace... 

Thread 1 "krita" received signal SIGSEGV, Segmentation fault.
QVector<QPointF>::operator= (other=..., this=0x55556175dfe0)
    at /usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h:78
78	    { QVector moved(std::move(other)); swap(moved); return *this; }
(gdb) bt
#0  0x00007fffe4155981 in QVector<QPointF>::operator=(QVector<QPointF>&&) (other=..., this=0x55556175dfe0)
    at /usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h:78
#1  0x00007fffe4155981 in KisToolSelectMagnetic::updateSelectedAnchor() (this=0x5555574d3a60)
    at /home/scott/git/krita/src/plugins/tools/selectiontools/KisToolSelectMagnetic.cc:416
#2  0x00007fffe41599fd in KisToolSelectMagnetic::endPrimaryAction(KoPointerEvent*)
    (this=0x5555574d3a60, event=0x7fffffffcd40)
    at /home/scott/git/krita/src/plugins/tools/selectiontools/KisToolSelectMagnetic.cc:321
#3  0x00007ffff6d25f84 in KisToolProxy::forwardToTool(KisToolProxy::ActionState, KisTool::ToolAction, QEvent*, QPointF const&)
    (this=<optimized out>, state=KisToolProxy::END, action=KisTool::Primary, event=0x7fffffffd490, docPoint=...) at /home/scott/git/krita/src/libs/ui/canvas/kis_tool_proxy.cpp:202
#4  0x00007ffff6d260e0 in KisToolProxy::forwardEvent(KisToolProxy::ActionState, KisTool::ToolAction, QEvent*, QEvent*)
    (this=0x555560b39fa0, state=state@entry=KisToolProxy::END, action=action@entry=KisTool::Primary, event=event@entry=0x7fffffffd490, originalEvent=originalEvent@entry=0x7fffffffd490)
    at /home/scott/git/krita/src/libs/ui/canvas/kis_tool_proxy.cpp:132
#5  0x00007ffff703d60d in KisToolInvocationAction::end(QEvent*)
    (this=0x55555f0ee820, event=0x7fffffffd490) at /usr/include/c++/9/bits/atomic_base.h:413
#6  0x00007ffff70482a7 in KisShortcutMatcher::tryEndRunningShortcut(Qt::MouseButton, QEvent*)
    (this=this@entry=0x55555f023620, button=<optimized out>, event=event@entry=0x7fffffffd490)
    at /home/scott/git/krita/src/libs/ui/input/kis_shortcut_matcher.cpp:679
#7  0x00007ffff7049516 in KisShortcutMatcher::buttonReleased(Qt::MouseButton, QEvent*)
    (this=0x55555f023620, button=<optimized out>, event=event@entry=0x7fffffffd490)
    at /home/scott/git/krita/src/libs/ui/input/kis_shortcut_matcher.cpp:296
Comment 3 Kuntal Majumder 2019-12-22 16:09:02 UTC
Git commit 6007e8142070077e91b509d635c3cb0fc0e16a83 by Kuntal Majumder.
Committed on 22/12/2019 at 16:05.
Pushed by kuntalmajumder into branch 'magnetic-lasso-patch'.

Adds a signal compressor to distiguish single and double clicks

Qt triggers a single click even for a double click,
so hacked a signal compressor which expects a delay
between 2 clicks to determine whether the first click
was a single click or belonged to a double click

M  +36   -23   plugins/tools/selectiontools/KisToolSelectMagnetic.cc
M  +3    -2    plugins/tools/selectiontools/KisToolSelectMagnetic.h

https://invent.kde.org/kde/krita/commit/6007e8142070077e91b509d635c3cb0fc0e16a83
Comment 4 Halla Rempt 2020-03-26 13:20:25 UTC
Git commit dacfa0aa507570d38c256c4f0ac5e585617c937a by Boudewijn Rempt, on behalf of Kuntal Majumder.
Committed on 26/03/2020 at 13:07.
Pushed by kuntalmajumder into branch 'master'.

Disable double click in magnetic lasso for now

M  +8    -0    plugins/tools/selectiontools/KisToolSelectMagnetic.cc
M  +1    -1    plugins/tools/selectiontools/KisToolSelectMagnetic.h

https://invent.kde.org/kde/krita/commit/dacfa0aa507570d38c256c4f0ac5e585617c937a
Comment 5 Halla Rempt 2020-04-02 13:34:31 UTC
Git commit 97fb0fc6d11f4a42c2c86cd5d40e92fdf8ddeb58 by Boudewijn Rempt, on behalf of Kuntal Majumder.
Committed on 02/04/2020 at 13:09.
Pushed by rempt into branch 'krita/4.3'.

Disable double click in magnetic lasso for now
(cherry picked from commit dacfa0aa507570d38c256c4f0ac5e585617c937a)

M  +8    -0    plugins/tools/selectiontools/KisToolSelectMagnetic.cc
M  +1    -1    plugins/tools/selectiontools/KisToolSelectMagnetic.h

https://invent.kde.org/kde/krita/commit/97fb0fc6d11f4a42c2c86cd5d40e92fdf8ddeb58
Comment 6 Halla Rempt 2020-05-04 09:30:31 UTC
I think that these crashes are gone now?
Comment 7 Kuntal Majumder 2020-05-04 09:32:25 UTC
Yes, since I essentially removed the actions which triggered the asserts.