Bug 393209

Summary: Krita crashes on the vector layer when undoing a mistake
Product: [Applications] krita Reporter: Pinky19295
Component: UsabilityAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: antti.savo, dimula73, scottpetrovic
Priority: NOR    
Version: 4.0.1   
Target Milestone: ---   
Platform: unspecified   
OS: All   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: attachment-5758-0.html
attachment-29835-0.html
attachment-23323-0.html

Description Pinky19295 2018-04-17 00:25:59 UTC
On the Vector Layer, when using the Shape Tool to curve lines, when I try to undo a mistake, Krita will have an error message pop up saying "Krita.exe has stopped working" then close.
Comment 1 Scott Petrovic 2018-04-17 15:45:16 UTC
Can you give exact steps to make this happen? I tried playing around with editing vector points, then undoing, and I am not getting any crashes.
Comment 2 Pinky19295 2018-04-18 00:19:16 UTC
Created attachment 112089 [details]
attachment-5758-0.html

First I opened the Vector Layer, then I drew a shape with the Line Tool,
then I tried shaping it with the Shape Tool (obviously), and when I
accidentally clicked on it twice, it made a square node, but when I tried
to do undo it it crashed the entire program.

I know that you can't undo the node, but I don't think it should crash the
entire program when trying to undo it.

And if it helps: I tried it on a different computer and it still did it.
Both of them are Windows 8.

I'm also using the newest version of Krita 4.0.1

On Tue, Apr 17, 2018 at 8:45 AM, Scott Petrovic <bugzilla_noreply@kde.org>
wrote:

> https://bugs.kde.org/show_bug.cgi?id=393209
>
> Scott Petrovic <scottpetrovic@gmail.com> changed:
>
>            What    |Removed                     |Added
> ------------------------------------------------------------
> ----------------
>                  CC|                            |scottpetrovic@gmail.com
>          Resolution|---                         |WAITINGFORINFO
>              Status|UNCONFIRMED                 |NEEDSINFO
>
> --- Comment #1 from Scott Petrovic <scottpetrovic@gmail.com> ---
> Can you give exact steps to make this happen? I tried playing around with
> editing vector points, then undoing, and I am not getting any crashes.
>
> --
> You are receiving this mail because:
> You reported the bug.
Comment 3 Antti Savolainen 2018-04-18 03:03:52 UTC
There we go, found a way to reproduce on Linux after the more detailed instructions. https://webmshare.com/6jDEB

Open vector layer
Draw a line with the Line Tool
Double click the Edit Shapes Tool so that a new node appears
Undo the node.

Informatio:
    Xubuntu 17.10
    krita 4.1.0-pre-alpha   

(gdb) bt
#0  0x00007ffff153eeee in KoPathShape::d_func() const (this=0x0) at ./libs/flake/KoPathShape.h:505
#1  0x00007ffff1539951 in KoPathShape::pathPointIndex(KoPathPoint const*) const (this=0x0, point=0x55555fbe0660) at ./libs/flake/KoPathShape.cpp:891
#2  0x00007ffff164b05e in KoPathToolSelection::selectedPointsData() const (this=0x5555612eac18) at ./libs/flake/tools/KoPathToolSelection.cpp:151
#3  0x00007ffff1647d33 in KoPathTool::updateActions() (this=0x5555612eac00) at ./libs/flake/tools/KoPathTool.cpp:1048
#4  0x00007ffff1702c39 in KoPathTool::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x5555612eac00, _c=QMetaObject::InvokeMetaMethod, _id=14, _a=0x7fffffffd290) at ./obj-x86_64-linux-gnu/libs/flake/kritaflake_autogen/CB6E7VNMGS/moc_KoPathTool.cpp:155
#5  0x00007ffff50f28e5 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007ffff77a0b87 in KisSelectedShapesProxy::selectionContentChanged() (this=0x55556117b9c8) at ./obj-x86_64-linux-gnu/libs/ui/kritaui_autogen/EWIEGA46WW/moc_KisSelectedShapesProxy.cpp:158
#7  0x00007ffff77a08e8 in KisSelectedShapesProxy::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x55556117b9c8, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fffffffd410)
    at ./obj-x86_64-linux-gnu/libs/ui/kritaui_autogen/EWIEGA46WW/moc_KisSelectedShapesProxy.cpp:82
#8  0x00007ffff50f28e5 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x00007ffff157a7fd in KoShapeManager::selectionContentChanged() (this=0x55555fcb7330) at ./obj-x86_64-linux-gnu/libs/flake/kritaflake_autogen/include/moc_KoShapeManager.cpp:180
#10 0x00007ffff1576d75 in KoShapeManager::Private::updateTree() (this=0x55555f195ed0) at ./libs/flake/KoShapeManager.cpp:95
#11 0x00007ffff1577c41 in KoShapeManager::paint(QPainter&, KoViewConverter const&, bool) (this=0x55555fcb7330, painter=..., converter=..., forPrint=false) at ./libs/flake/KoShapeManager.cpp:253
#12 0x00007ffff7353f16 in KisShapeLayerCanvas::repaint() (this=0x555560cf9760) at ./libs/ui/flake/kis_shape_layer_canvas.cpp:296
#13 0x00007ffff77accf6 in KisShapeLayerCanvas::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x555560cf9760, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x555560d7e1f0)
    at ./obj-x86_64-linux-gnu/libs/ui/kritaui_autogen/QUY67KCZCL/moc_kis_shape_layer_canvas.cpp:87
#14 0x00007ffff50f3452 in QObject::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007ffff5e3e46c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007ffff5e45d34 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007ffff76aa495 in KisApplication::notify(QObject*, QEvent*) (this=0x7fffffffddb0, receiver=0x555560cf9760, event=0x7fffd8007af0) at ./libs/ui/KisApplication.cpp:652
#18 0x00007ffff50c3de8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007ffff50c655d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007ffff511ce53 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#21 0x00007fffec790fb7 in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#22 0x00007fffec7911f0 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007fffec79127c in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007ffff511c47f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#25 0x00007ffff50c1e3a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#26 0x00007ffff50cada4 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#27 0x0000555555849423 in main(int, char**) (argc=1, argv=0x7fffffffdf38) at ./krita/main.cc:361
Comment 4 Pinky19295 2018-04-18 14:46:49 UTC
Created attachment 112101 [details]
attachment-29835-0.html

Undoing the node still crashes the program.

On Tue, Apr 17, 2018 at 8:03 PM, Antti Savolainen <bugzilla_noreply@kde.org>
wrote:

> https://bugs.kde.org/show_bug.cgi?id=393209
>
> Antti Savolainen <antti.savo@gmail.com> changed:
>
>            What    |Removed                     |Added
> ------------------------------------------------------------
> ----------------
>          Resolution|WAITINGFORINFO              |---
>              Status|NEEDSINFO                   |CONFIRMED
>      Ever confirmed|0                           |1
>                  OS|MS Windows                  |All
>                  CC|                            |antti.savo@gmail.com
>            Platform|MS Windows                  |unspecified
>
> --- Comment #3 from Antti Savolainen <antti.savo@gmail.com> ---
> There we go, found a way to reproduce on Linux after the more detailed
> instructions. https://webmshare.com/6jDEB
>
> Open vector layer
> Draw a line with the Line Tool
> Double click the Edit Shapes Tool so that a new node appears
> Undo the node.
>
> Informatio:
>     Xubuntu 17.10
>     krita 4.1.0-pre-alpha
>
> (gdb) bt
> #0  0x00007ffff153eeee in KoPathShape::d_func() const (this=0x0) at
> ./libs/flake/KoPathShape.h:505
> #1  0x00007ffff1539951 in KoPathShape::pathPointIndex(KoPathPoint const*)
> const
> (this=0x0, point=0x55555fbe0660) at ./libs/flake/KoPathShape.cpp:891
> #2  0x00007ffff164b05e in KoPathToolSelection::selectedPointsData() const
> (this=0x5555612eac18) at ./libs/flake/tools/KoPathToolSelection.cpp:151
> #3  0x00007ffff1647d33 in KoPathTool::updateActions()
> (this=0x5555612eac00) at
> ./libs/flake/tools/KoPathTool.cpp:1048
> #4  0x00007ffff1702c39 in KoPathTool::qt_static_metacall(QObject*,
> QMetaObject::Call, int, void**) (_o=0x5555612eac00,
> _c=QMetaObject::InvokeMetaMethod, _id=14, _a=0x7fffffffd290) at
> ./obj-x86_64-linux-gnu/libs/flake/kritaflake_autogen/
> CB6E7VNMGS/moc_KoPathTool.cpp:155
> #5  0x00007ffff50f28e5 in QMetaObject::activate(QObject*, int, int,
> void**) ()
> at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> #6  0x00007ffff77a0b87 in KisSelectedShapesProxy::
> selectionContentChanged()
> (this=0x55556117b9c8) at
> ./obj-x86_64-linux-gnu/libs/ui/kritaui_autogen/EWIEGA46WW/
> moc_KisSelectedShapesProxy.cpp:158
> #7  0x00007ffff77a08e8 in KisSelectedShapesProxy::qt_
> static_metacall(QObject*,
> QMetaObject::Call, int, void**) (_o=0x55556117b9c8,
> _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fffffffd410)
>     at
> ./obj-x86_64-linux-gnu/libs/ui/kritaui_autogen/EWIEGA46WW/
> moc_KisSelectedShapesProxy.cpp:82
> #8  0x00007ffff50f28e5 in QMetaObject::activate(QObject*, int, int,
> void**) ()
> at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> #9  0x00007ffff157a7fd in KoShapeManager::selectionContentChanged()
> (this=0x55555fcb7330) at
> ./obj-x86_64-linux-gnu/libs/flake/kritaflake_autogen/
> include/moc_KoShapeManager.cpp:180
> #10 0x00007ffff1576d75 in KoShapeManager::Private::updateTree()
> (this=0x55555f195ed0) at ./libs/flake/KoShapeManager.cpp:95
> #11 0x00007ffff1577c41 in KoShapeManager::paint(QPainter&, KoViewConverter
> const&, bool) (this=0x55555fcb7330, painter=..., converter=...,
> forPrint=false)
> at ./libs/flake/KoShapeManager.cpp:253
> #12 0x00007ffff7353f16 in KisShapeLayerCanvas::repaint()
> (this=0x555560cf9760)
> at ./libs/ui/flake/kis_shape_layer_canvas.cpp:296
> #13 0x00007ffff77accf6 in KisShapeLayerCanvas::qt_
> static_metacall(QObject*,
> QMetaObject::Call, int, void**) (_o=0x555560cf9760,
> _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x555560d7e1f0)
>     at
> ./obj-x86_64-linux-gnu/libs/ui/kritaui_autogen/QUY67KCZCL/
> moc_kis_shape_layer_canvas.cpp:87
> #14 0x00007ffff50f3452 in QObject::event(QEvent*) () at
> /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> #15 0x00007ffff5e3e46c in QApplicationPrivate::notify_helper(QObject*,
> QEvent*)
> () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> #16 0x00007ffff5e45d34 in QApplication::notify(QObject*, QEvent*) () at
> /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> #17 0x00007ffff76aa495 in KisApplication::notify(QObject*, QEvent*)
> (this=0x7fffffffddb0, receiver=0x555560cf9760, event=0x7fffd8007af0) at
> ./libs/ui/KisApplication.cpp:652
> #18 0x00007ffff50c3de8 in QCoreApplication::notifyInternal2(QObject*,
> QEvent*)
> () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> #19 0x00007ffff50c655d in QCoreApplicationPrivate::
> sendPostedEvents(QObject*,
> int, QThreadData*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> #20 0x00007ffff511ce53 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> #21 0x00007fffec790fb7 in g_main_context_dispatch () at
> /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #22 0x00007fffec7911f0 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #23 0x00007fffec79127c in g_main_context_iteration () at
> /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #24 0x00007ffff511c47f in
> QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
> ()
> at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> #25 0x00007ffff50c1e3a in
> QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at
> /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> #26 0x00007ffff50cada4 in QCoreApplication::exec() () at
> /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> #27 0x0000555555849423 in main(int, char**) (argc=1, argv=0x7fffffffdf38)
> at
> ./krita/main.cc:361
>
> --
> You are receiving this mail because:
> You reported the bug.
>
Comment 5 Antti Savolainen 2018-04-18 20:21:03 UTC
That was only the confirmation of the crash
Comment 6 Dmitry Kazakov 2018-04-18 20:53:17 UTC
Hi, Pinky19295 and Antti!

Thank you for your information in the report. I will try to fix that. The problem seem to be not very easy though... :(

It seems like bug 393087 is also related (though a bit different)
Comment 7 Pinky19295 2018-04-19 19:05:31 UTC
Created attachment 112125 [details]
attachment-23323-0.html

No problem. I'll do my best to report future bugs if I come across them.

On Wed, Apr 18, 2018 at 1:53 PM, Dmitry Kazakov <bugzilla_noreply@kde.org>
wrote:

> https://bugs.kde.org/show_bug.cgi?id=393209
>
> Dmitry Kazakov <dimula73@gmail.com> changed:
>
>            What    |Removed                     |Added
> ------------------------------------------------------------
> ----------------
>                  CC|                            |dimula73@gmail.com
>
> --- Comment #6 from Dmitry Kazakov <dimula73@gmail.com> ---
> Hi, Pinky19295 and Antti!
>
> Thank you for your information in the report. I will try to fix that. The
> problem seem to be not very easy though... :(
>
> It seems like bug 393087 is also related (though a bit different)
>
> --
> You are receiving this mail because:
> You reported the bug.
>
Comment 8 Dmitry Kazakov 2018-04-24 13:12:41 UTC
Git commit 25a628eb1ae047b37045cda4bc705dfc2b0b5731 by Dmitry Kazakov.
Committed on 24/04/2018 at 13:12.
Pushed by dkazakov into branch 'master'.

Fix crashes on undo/redo of vector path points operations

1) KoPathToolSelection keeps pointers to the shapes and its path points,
   therefore it should subscribe to the updates on the shapes and their
   points (using ShapeChangeListener framework).

2) The patch also fixes a lot of bugs in "Join by segment" and
   "Merge points", which should behave correctly now.

3) The patch also partially implements "keep path point selection"
   idea, which selects newly created point after each operation. The
   stuff is achieved using KoPathShape::PointSelectionChangeListener
   listener.
Related: bug 393087

M  +1    -0    libs/flake/CMakeLists.txt
M  +70   -2    libs/flake/KoPathShape.cpp
M  +12   -0    libs/flake/KoPathShape.h
M  +2    -0    libs/flake/KoPathShape_p.h
M  +5    -11   libs/flake/commands/KoMultiPathPointMergeCommand.cpp
M  +9    -0    libs/flake/commands/KoPathBreakAtPointCommand.cpp
A  +70   -0    libs/flake/commands/KoPathMergeUtils.cpp     [License: GPL (v2+)]
A  +37   -0    libs/flake/commands/KoPathMergeUtils.h     [License: GPL (v2+)]
M  +13   -1    libs/flake/commands/KoPathPointInsertCommand.cpp
M  +98   -120  libs/flake/commands/KoPathPointMergeCommand.cpp
M  +11   -0    libs/flake/commands/KoPathPointRemoveCommand.cpp
M  +63   -39   libs/flake/commands/KoSubpathJoinCommand.cpp
M  +10   -3    libs/flake/commands/KoSubpathJoinCommand.h
M  +15   -2    libs/flake/tools/KoPathTool.cpp
M  +3    -0    libs/flake/tools/KoPathTool.h
M  +62   -0    libs/flake/tools/KoPathToolSelection.cpp
M  +6    -1    libs/flake/tools/KoPathToolSelection.h
M  +4    -0    plugins/flake/pathshapes/ellipse/EllipseShape.cpp
M  +2    -0    plugins/flake/pathshapes/enhancedpath/EnhancedPathShape.cpp
M  +4    -0    plugins/flake/pathshapes/rectangle/RectangleShape.cpp
M  +2    -0    plugins/flake/pathshapes/spiral/SpiralShape.cpp
M  +2    -0    plugins/flake/pathshapes/star/StarShape.cpp

https://commits.kde.org/krita/25a628eb1ae047b37045cda4bc705dfc2b0b5731
Comment 9 Halla Rempt 2018-05-02 12:00:17 UTC
Git commit ba377491cdd4bc825de07035f7ed2e0a05545c84 by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 02/05/2018 at 11:54.
Pushed by rempt into branch 'krita/4.0'.

Fix crashes on undo/redo of vector path points operations

1) KoPathToolSelection keeps pointers to the shapes and its path points,
   therefore it should subscribe to the updates on the shapes and their
   points (using ShapeChangeListener framework).

2) The patch also fixes a lot of bugs in "Join by segment" and
   "Merge points", which should behave correctly now.

3) The patch also partially implements "keep path point selection"
   idea, which selects newly created point after each operation. The
   stuff is achieved using KoPathShape::PointSelectionChangeListener
   listener.
Related: bug 393087
(cherry picked from commit f919e7f2dbed028e8fdae89b58ed6f5af26760db)

M  +1    -0    libs/flake/CMakeLists.txt
M  +70   -2    libs/flake/KoPathShape.cpp
M  +12   -0    libs/flake/KoPathShape.h
M  +2    -0    libs/flake/KoPathShape_p.h
M  +5    -11   libs/flake/commands/KoMultiPathPointMergeCommand.cpp
M  +9    -0    libs/flake/commands/KoPathBreakAtPointCommand.cpp
A  +70   -0    libs/flake/commands/KoPathMergeUtils.cpp     [License: GPL (v2+)]
A  +37   -0    libs/flake/commands/KoPathMergeUtils.h     [License: GPL (v2+)]
M  +13   -1    libs/flake/commands/KoPathPointInsertCommand.cpp
M  +98   -120  libs/flake/commands/KoPathPointMergeCommand.cpp
M  +11   -0    libs/flake/commands/KoPathPointRemoveCommand.cpp
M  +63   -39   libs/flake/commands/KoSubpathJoinCommand.cpp
M  +10   -3    libs/flake/commands/KoSubpathJoinCommand.h
M  +15   -2    libs/flake/tools/KoPathTool.cpp
M  +3    -0    libs/flake/tools/KoPathTool.h
M  +62   -0    libs/flake/tools/KoPathToolSelection.cpp
M  +6    -1    libs/flake/tools/KoPathToolSelection.h
M  +4    -0    plugins/flake/pathshapes/ellipse/EllipseShape.cpp
M  +2    -0    plugins/flake/pathshapes/enhancedpath/EnhancedPathShape.cpp
M  +4    -0    plugins/flake/pathshapes/rectangle/RectangleShape.cpp
M  +2    -0    plugins/flake/pathshapes/spiral/SpiralShape.cpp
M  +2    -0    plugins/flake/pathshapes/star/StarShape.cpp

https://commits.kde.org/krita/ba377491cdd4bc825de07035f7ed2e0a05545c84