Bug 455584

Summary: Deleting assistants or undoing causes krita to crash
Product: [Applications] krita Reporter: thetwo <thetwo222>
Component: Tool/AssistantsAssignee: Tiar <tamtamy.tymona>
Status: RESOLVED FIXED    
Severity: crash CC: halla, tamtamy.tymona
Priority: NOR    
Version: 5.0.6   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed In:
Attachments: bug

Description thetwo 2022-06-19 05:44:35 UTC
Created attachment 149921 [details]
bug

SUMMARY
Told by a friend and confirmed that it can be triggered stably

1.Create a ruler
2.Save ruler file locally(.paintingassistant)
3.Click the icon to delete the ruler (do not "delete all")
4.Import the ruler file 
5.undo,and krita crash
Comment 1 Halla Rempt 2022-06-24 08:57:59 UTC
Important an assistant is also not undoable.

Backtrace with line numbers:

#1  0x00007ffff52f7859 in __GI_abort () at abort.c:79
#2  0x00007ffff57a4455 in QMessageLogger::fatal(char const*, ...) const ()
   from /home/halla/dev/deps/lib/libQt5Core.so.5
#3  0x00007ffff698bfbd in kis_assert_common (assertion=0x7fffffffc640 "0n6\\UU", 
    file=0x7fffffffc648 "\020\063\257`UU", line=<optimized out>, throwException=<optimized out>, 
    isIgnorable=<optimized out>) at /home/halla/dev/krita/libs/global/kis_assert.cpp:89
#4  0x00007fffd2bb05ed in EditAssistantsCommand::replaceWith (this=0x555560008090, newAssistants=..., 
    type=EditAssistantsCommand::ADD)
    at /home/halla/dev/krita/plugins/assistants/Assistants/EditAssistantsCommand.cpp:47
#5  0x00007fffd2bb0974 in EditAssistantsCommand::undo (this=0x555560008090)
    at /home/halla/dev/krita/plugins/assistants/Assistants/EditAssistantsCommand.cpp:74
#6  0x00007ffff45cc0da in KUndo2Command::undoMergedCommands (this=0x555560008090)
    at /home/halla/dev/krita/libs/command/kundo2stack.cpp:385
#7  0x00007ffff45cafba in KUndo2QStack::undo (this=0x55555db18c90)
    at /home/halla/dev/krita/libs/command/kundo2stack.cpp:962
#8  0x00007ffff7c33d9b in UndoStack::undoImpl (this=0x55555db18c90)
    at /home/halla/dev/krita/libs/ui/KisDocument.cpp:227
#9  UndoStack::processPostponedJobs (this=0x55555db18c90) at /home/halla/dev/krita/libs/ui/KisDocument.cpp:265
#10 0x00007ffff59d30f0 in QMetaObject::activate(QObject*, int, int, void**) ()
   from /home/halla/dev/deps/lib/libQt5Core.so.5
#11 0x00007ffff63d7a36 in QAction::triggered(bool) () from /home/halla/dev/deps/lib/libQt5Widgets.so.5
#12 0x00007ffff63da0f2 in QAction::activate(QAction::ActionEvent) ()
   from /home/halla/dev/deps/lib/libQt5Widgets.so.5
#13 0x00007ffff63da9bf in QAction::event(QEvent*) () from /home/halla/dev/deps/lib/libQt5Widgets.so.5
#14 0x00007ffff63de0d6 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /home/halla/dev/deps/lib/libQt5Widgets.so.5
#15 0x00007ffff63e75d0 in QApplication::notify(QObject*, QEvent*) ()
   from /home/halla/dev/deps/lib/libQt5Widgets.so.5
#16 0x00007ffff7c1d3d5 in KisApplication::notify (this=0x7fffffffd4f0, receiver=0x5555592bbeb0, 
    event=0x7fffffffcdc0) at /home/halla/dev/krita/libs/ui/KisApplication.cpp:761
#17 0x00007ffff59a76ea in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
   from /home/halla/dev/deps/lib/libQt5Core.so.5
#18 0x00007ffff5dc393e in QShortcutMap::dispatchEvent(QKeyEvent*) ()
   from /home/halla/dev/deps/lib/libQt5Gui.so.5
#19 0x00007ffff5dc3a23 in QShortcutMap::tryShortcut(QKeyEvent*) () from /home/halla/dev/deps/lib/libQt5Gui.so.5
#20 0x00007ffff5d77cf3 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) ()
   from /home/halla/dev/deps/lib/libQt5Gui.so.5
#21 0x00007ffff5d95231 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) ()
   from /home/halla/dev/deps/lib/libQt5Gui.so.5
#22 0x00007ffff5d9a8d1 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /home/halla/dev/deps/lib/libQt5Gui.so.5
#23 0x00007ffff5d7497c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>)
    () from /home/halla/dev/deps/lib/libQt5Gui.so.5
#24 0x00007fffefeb454e in ?? () from /home/halla/dev/deps/lib/libQt5XcbQpa.so.5
#25 0x00007ffff2cec17d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#26 0x00007ffff2cec400 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#27 0x00007ffff2cec4a3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007ffff59ff635 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /home/halla/dev/deps/lib/libQt5Core.so.5
#29 0x00007ffff59a629b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /home/halla/dev/deps/lib/libQt5Core.so.5
#30 0x00007ffff59adff6 in QCoreApplication::exec() () from /home/halla/dev/deps/lib/libQt5Core.so.5
#31 0x000055555555dd5b in main (argc=<optimized out>, argv=<optimized ou
Comment 2 Bug Janitor Service 2022-06-25 00:48:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1490
Comment 3 Tiar 2022-06-27 16:50:07 UTC
Git commit 6579f94c8f35311007212cca38d891e7c0c1f0c6 by Agata Cacko.
Committed on 27/06/2022 at 13:05.
Pushed by tymond into branch 'master'.

Fix crash on undo after importing assistant set

Before this commit, importing assistant set was not undoable,
which broke internal state of the tool, which led to crash.
This commit makes importing the assistant set undoable,
preventing the crash.

M  +8    -1    plugins/assistants/Assistants/kis_assistant_tool.cc

https://invent.kde.org/graphics/krita/commit/6579f94c8f35311007212cca38d891e7c0c1f0c6
Comment 4 Tiar 2022-06-27 18:07:57 UTC
Git commit ff115ccb7b7428da9f51ac5157ac8213b8d8e58b by Agata Cacko.
Committed on 27/06/2022 at 18:07.
Pushed by tymond into branch 'krita/5.1'.

Fix crash on undo after importing assistant set

Before this commit, importing assistant set was not undoable,
which broke internal state of the tool, which led to crash.
This commit makes importing the assistant set undoable,
preventing the crash.


(cherry picked from commit 6579f94c8f35311007212cca38d891e7c0c1f0c6)

M  +8    -1    plugins/assistants/Assistants/kis_assistant_tool.cc

https://invent.kde.org/graphics/krita/commit/ff115ccb7b7428da9f51ac5157ac8213b8d8e58b