Bug 434601

Summary: Assert on switching visibility
Product: [Applications] krita Reporter: Tiar <tamtamy.tymona>
Component: Layer StackAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: crash CC: ahab.greybeard, dimula73, halla
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Crash log for all threads
Crashlog for all threads

Description Tiar 2021-03-19 00:36:15 UTC
Created attachment 136834 [details]
Crash log for all threads

SUMMARY
The layer I switched visibility of had Multiply blending mode. Other than that, it was all normal...

STEPS TO REPRODUCE
1. ?

OBSERVED RESULT
Crash

EXPECTED RESULT
No crash! :D

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

ADDITIONAL INFORMATION
Full crashlog in the attachment.

Entering "KisStrokeSpeedMonitor::notifyStrokeFinished()" " CS: 2.66219  RS: 1.71976  FPS: 29.9757 (saturated)"
Entering "KisStrokeSpeedMonitor::notifyStrokeFinished()" "ACS: 2.76704 ARS: 1.95968 AFPS: 32.1167"
Entering "KisStrokeSpeedMonitor::notifyStrokeFinished()" " CS: 0.63214  RS: 2.28152  FPS: 49.8084 "
Entering "KisStrokeSpeedMonitor::notifyStrokeFinished()" "ACS: 2.76704 ARS: 1.95968 AFPS: 32.1167"
SAFE ASSERT (krita): "m_newCompositeOp == other->m_oldCompositeOp" in file /home/tymon/kritadev/krita/libs/image/commands/kis_node_compositeop_command.cpp, line 54
SAFE ASSERT (krita): "m_newPropertyList == other->m_oldPropertyList" in file /home/tymon/kritadev/krita/libs/image/commands/kis_node_property_list_command.cpp, line 101

Thread 1 "krita" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: Nie ma takiego pliku ani katalogu.
(gdb) bt
#0  0x00007ffff3d65ed7 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff3d47535 in __GI_abort () at abort.c:79
#2  0x00007ffff452f8d7 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#3  0x00007ffff563c3b8 in kis_assert_common(char const*, char const*, int, bool, bool) (assertion=0x7ffff5e17c50 "m_newPropertyList == other->m_oldPropertyList", file=0x7ffff5e17bf8 "/home/tymon/kritadev/krita/libs/image/commands/kis_node_property_list_command.cpp", line=101, throwException=false, isIgnorable=true) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h:206
#4  0x00007ffff563c81d in kis_safe_assert_recoverable(char const*, char const*, int) (assertion=assertion@entry=0x7ffff5e17c50 "m_newPropertyList == other->m_oldPropertyList", file=file@entry=0x7ffff5e17bf8 "/home/tymon/kritadev/krita/libs/image/commands/kis_node_property_list_command.cpp", line=line@entry=101) at /home/tymon/kritadev/krita/libs/global/kis_assert.cpp:107
#5  0x00007ffff5a7af28 in KisNodePropertyListCommand::mergeWith(KUndo2Command const*) (this=0x5555756f1d70, command=<optimized out>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qhash.h:583
#6  0x00007ffff2885fb4 in KUndo2QStack::push(KUndo2Command*) (this=0x55556a8f0d00, cmd=<optimized out>) at /home/tymon/kritadev/krita/libs/command/kundo2stack.cpp:850
#7  0x00007ffff5d14e52 in KisLegacyUndoAdapter::addCommand(KUndo2Command*) (command=0x55556a69a630, this=0x55555f8ccd40) at /home/tymon/kritadev/krita/libs/image/kis_undo_adapter.h:42
#8  0x00007ffff5d14e52 in KisLegacyUndoAdapter::addCommand(KUndo2Command*) (this=0x55555f8ccd40, command=0x55556a69a630) at /home/tymon/kritadev/krita/libs/image/kis_legacy_undo_adapter.cpp:30
#9  0x00007ffff5a7a5e1 in KisNodePropertyListCommand::setNodePropertiesAutoUndo(KisSharedPtr<KisNode>, KisSharedPtr<KisImage>, QList<KisBaseNode::Property>) (node=..., image=..., proplist=...)
    at /home/tymon/kritadev/krita/libs/global/kis_shared_ptr.h:167
#10 0x00007ffff6d2c5e7 in KisNodeManager::trySetNodeProperties(KisSharedPtr<KisNode>, KisSharedPtr<KisImage>, QList<KisBaseNode::Property>) const (this=0x55555a316040, node=..., image=..., properties=...)
    at /usr/include/c++/8/bits/atomic_base.h:295
#11 0x00007ffff6d48779 in KisNodeModel::setData(QModelIndex const&, QVariant const&, int) (this=0x55555f972090, index=..., value=..., role=<optimized out>) at /usr/include/c++/8/bits/atomic_base.h:295
#12 0x00007ffff46f0a2a in QSortFilterProxyModel::setData(QModelIndex const&, QVariant const&, int) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007fffc66644db in NodeDelegate::Private::toggleProperty(QList<KisBaseNode::Property>&, KisBaseNode::Property*, QFlags<Qt::KeyboardModifier>, QModelIndex const&) (this=<optimized out>, props=..., clickedProperty=<optimized out>, modifier=..., index=...) at /home/tymon/kritadev/krita/libs/image/kis_base_node.h:609
#14 0x00007fffc666578f in NodeDelegate::editorEvent(QEvent*, QAbstractItemModel*, QStyleOptionViewItem const&, QModelIndex const&) (this=0x55555f93b3e0, event=0x7fffffffd400, model=0x55555f9653a0, option=..., index=...)
    at /usr/include/x86_64-linux-gnu/qt5/QtGui/qevent.h:73
#15 0x00007fffc666b79b in NodeView::viewportEvent(QEvent*) (this=0x55555f936050, e=0x7fffffffd400) at /home/tymon/kritadev/krita/plugins/dockers/layerdocker/NodeView.cpp:266
#16 0x00007ffff47191ab in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#17 0x00007ffff50d8491 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007ffff50dfd28 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#19 0x00007ffff6ff75b7 in KisApplication::notify(QObject*, QEvent*) (this=<optimized out>, receiver=0x55555f92b430, event=0x7fffffffd400) at /home/tymon/kritadev/krita/libs/ui/KisApplication.cpp:710
#20 0x00007ffff4719499 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#21 0x00007ffff50df029 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#22 0x00007ffff5131304 in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007ffff5133e8e in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007ffff50d84a1 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#25 0x00007ffff50dfae0 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#26 0x00007ffff6ff75b7 in KisApplication::notify(QObject*, QEvent*) (this=<optimized out>, receiver=0x55555915a130, event=0x7fffffffd880) at /home/tymon/kritadev/krita/libs/ui/KisApplication.cpp:710
#27 0x00007ffff4719499 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#28 0x00007ffff4b1e53b in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#29 0x00007ffff4b20435 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#30 0x00007ffff4afab6b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#31 0x00007fffea76ee5b in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#32 0x00007ffff471816b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#33 0x00007ffff47202e2 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#34 0x0000555555e2a21b in main (argc=<optimized out>, argv=0x7fffffffde38) at /home/tymon/kritadev/krita/krita/main.cc:663
#35 0x00007ffff3d48b6b in __libc_start_main (main=0x555555e28890 <main>, argc=1, argv=0x7fffffffde38, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffde28) at ../csu/libc-start.c:308
#36 0x0000555555e2b2da in _start () at /home/tymon/kritadev/krita/krita/main.cc:468
Comment 1 Ahab Greybeard 2021-03-19 15:29:57 UTC
With the Mar 18 5.0.0 prealpha (git e5cb8a6) on Debian 10, I don't see anything unusual happening if I do this.
I used three layers with casual overlapping content and tried various combinations of Multipy layer blending mode and visibility toggling.
Comment 2 Tiar 2021-03-28 01:00:21 UTC
Created attachment 137119 [details]
Crashlog for all threads

Another, a bit different backtrace.

What I was doing: trying to reproduce bug 411573; I think I added a File Layer, then I added a Paint Layer, moved the Paint Layer up and then tried to open the File Layer? Something like this. Much less switching visibility, there was some moving and I did try to open the file layer, but the order might be different and there is a chance I misclicked something.
---

SAFE ASSERT (krita): "m_newPropertyList == other->m_oldPropertyList" in file /home/tymon/kritadev/krita/libs/image/commands/kis_node_property_list_command.cpp, line 101

Thread 1 "krita" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: Nie ma takiego pliku ani katalogu.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff401a859 in __GI_abort () at abort.c:79
#2  0x00007ffff446aaad in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#3  0x00007ffff562825d in kis_assert_common(char const*, char const*, int, bool, bool) (assertion=<optimized out>, file=<optimized out>, line=<optimized out>, throwException=<optimized out>, isIgnorable=<optimized out>)
    at /usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h:208
#4  0x00007ffff5a7fdb8 in KisNodePropertyListCommand::mergeWith(KUndo2Command const*) (this=0x55555c6f0a30, command=<optimized out>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qhash.h:585
#5  0x00007ffff30672d9 in KUndo2QStack::push(KUndo2Command*) (this=0x555563283eb0, cmd=<optimized out>) at /home/tymon/kritadev/krita/libs/command/kundo2stack.cpp:850
#6  0x00007ffff5d16318 in KisLegacyUndoAdapter::addCommand(KUndo2Command*) (command=0x55555afc11a0, this=0x555565363170) at /home/tymon/kritadev/krita/libs/image/kis_undo_adapter.h:42
#7  KisLegacyUndoAdapter::addCommand(KUndo2Command*) (this=0x555565363170, command=0x55555afc11a0) at /home/tymon/kritadev/krita/libs/image/kis_legacy_undo_adapter.cpp:30
#8  0x00007ffff5a7f83d in KisNodePropertyListCommand::setNodePropertiesAutoUndo(KisSharedPtr<KisNode>, KisSharedPtr<KisImage>, QList<KisBaseNode::Property>) (node=..., image=..., proplist=...)
    at /home/tymon/kritadev/krita/libs/global/kis_shared_ptr.h:167
#9  0x00007ffff6d60caa in KisNodeManager::trySetNodeProperties(KisSharedPtr<KisNode>, KisSharedPtr<KisImage>, QList<KisBaseNode::Property>) const (this=this@entry=0x555558eccae0, node=..., image=..., properties=...)
    at /usr/include/c++/9/bits/atomic_base.h:318
#10 0x00007ffff6d82115 in KisNodeModel::setData(QModelIndex const&, QVariant const&, int) (this=0x55555c315330, index=..., value=..., role=<optimized out>) at /usr/include/c++/9/bits/atomic_base.h:318
#11 0x00007ffff463ed61 in QSortFilterProxyModel::setData(QModelIndex const&, QVariant const&, int) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00007fffd04d592f in NodeDelegate::Private::toggleProperty(QList<KisBaseNode::Property>&, KisBaseNode::Property*, QFlags<Qt::KeyboardModifier>, QModelIndex const&)
    (this=<optimized out>, props=..., clickedProperty=<optimized out>, modifier=..., index=...) at /home/tymon/kritadev/krita/libs/image/kis_base_node.h:609
#13 0x00007fffd04d6f55 in NodeDelegate::editorEvent(QEvent*, QAbstractItemModel*, QStyleOptionViewItem const&, QModelIndex const&)
    (this=this@entry=0x55555c30baf0, event=event@entry=0x7fffffffd3d0, model=<optimized out>, option=..., index=...) at /usr/include/x86_64-linux-gnu/qt5/QtGui/qevent.h:73
#14 0x00007fffd04dd040 in NodeView::viewportEvent(QEvent*) (this=0x55555c306390, e=0x7fffffffd3d0) at /home/tymon/kritadev/krita/plugins/dockers/layerdocker/NodeView.cpp:266
#15 0x00007ffff466b64b in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#16 0x00007ffff5083a55 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007ffff508d343 in QApplication::notify(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007ffff703776d in KisApplication::notify(QObject*, QEvent*) (this=<optimized out>, receiver=0x55555c2fbb20, event=0x7fffffffd3d0) at /home/tymon/kritadev/krita/libs/ui/KisApplication.cpp:711
#19 0x00007ffff466b93a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007ffff508c457 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00007ffff50e235d in  () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#22 0x00007ffff50e51ec in  () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007ffff5083a66 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007ffff508d0f0 in QApplication::notify(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#25 0x00007ffff703776d in KisApplication::notify(QObject*, QEvent*) (this=<optimized out>, receiver=0x55555c9f4940, event=0x7fffffffd8d0) at /home/tymon/kritadev/krita/libs/ui/KisApplication.cpp:711
#26 0x00007ffff466b93a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#27 0x00007ffff4a547d3 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /lib/x86_64-linux-gnu/libQt5Gui.so.5
#28 0x00007ffff4a5610b in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /lib/x86_64-linux-gnu/libQt5Gui.so.5
#29 0x00007ffff4a3035b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt5Gui.so.5
#30 0x00007fffee95432e in  () at /lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#31 0x00007ffff1a1917d in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007ffff1a19400 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007ffff1a194a3 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#34 0x00007ffff46c3565 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#35 0x00007ffff466a4db in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#36 0x00007ffff4672246 in QCoreApplication::exec() () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#37 0x0000555555e2a5ed in main(int, char**) (argc=<optimized out>, argv=0x7fffffffdf98) at /home/tymon/kritadev/krita/krita/main.cc:663
Comment 3 Ahab Greybeard 2021-04-01 10:17:44 UTC
With the Mar 30 5.0.0-prealpha (git 783e86c) appimage, I tried adding File layers, paint layers, moving layers, opening file layers, etc in various combinations but I don't get a crash or an assert in the log.
Comment 4 Dmitry Kazakov 2021-07-30 07:11:15 UTC
Hi, Tiar!

Do you remember, did you have any Colorize Masks in that image? I can reproduce the "m_newCompositeOp == other->m_oldCompositeOp" assert, but not the visibility one.
Comment 5 Dmitry Kazakov 2021-07-30 08:17:53 UTC
Okay, I can reproduce the issue with the file layer as well :)
Comment 6 Dmitry Kazakov 2021-07-30 10:37:34 UTC
Git commit eb26018e85aa2f81da82801bc614ed5f13d77712 by Dmitry Kazakov.
Committed on 30/07/2021 at 08:28.
Pushed by dkazakov into branch 'master'.

Fix assert when changing layer's blending mode too quickly

The blending mode is updated asynchronously, so at the point
of creation of undo command we may not know the current value
of the layer's composite op. We should read it during the first
redo execution.

M  +11   -5    libs/image/commands/kis_node_compositeop_command.cpp
M  +3    -2    libs/image/commands/kis_node_compositeop_command.h
M  +13   -4    libs/image/commands/kis_node_opacity_command.cpp
M  +3    -2    libs/image/commands/kis_node_opacity_command.h
M  +1    -1    libs/image/kis_layer_utils.cpp
M  +0    -1    libs/libkis/Node.cpp
M  +2    -2    libs/ui/kis_node_commands_adapter.cpp

https://invent.kde.org/graphics/krita/commit/eb26018e85aa2f81da82801bc614ed5f13d77712
Comment 7 Dmitry Kazakov 2021-07-30 10:37:42 UTC
Git commit 687ff690f70d48c8f0097d08cf397db7967b341f by Dmitry Kazakov.
Committed on 30/07/2021 at 08:25.
Pushed by dkazakov into branch 'master'.

Fix assert when clicking on File Layer's open-file property too much

M  +3    -1    libs/image/commands/kis_node_property_list_command.cpp

https://invent.kde.org/graphics/krita/commit/687ff690f70d48c8f0097d08cf397db7967b341f
Comment 8 Dmitry Kazakov 2021-07-30 10:37:50 UTC
Git commit cb4cd7ef4c9cecfdfd4e68e15511415200a40048 by Dmitry Kazakov.
Committed on 30/07/2021 at 10:35.
Pushed by dkazakov into branch 'master'.

Implement ahhihilation of opacity and blending mode change commands

If the user changes the blending mode or opacity to and fro, then no
undo command should be created.

M  +2    -2    libs/command/kundo2stack.cpp
M  +1    -1    libs/command/kundo2stack.h
M  +13   -0    libs/image/commands/kis_node_compositeop_command.cpp
M  +2    -0    libs/image/commands/kis_node_compositeop_command.h
M  +13   -0    libs/image/commands/kis_node_opacity_command.cpp
M  +1    -0    libs/image/commands/kis_node_opacity_command.h
M  +1    -1    libs/image/commands/kis_node_property_list_command.cpp
M  +1    -1    libs/image/commands/kis_node_property_list_command.h
M  +51   -0    libs/image/commands_new/kis_saved_commands.cpp
M  +2    -1    libs/image/commands_new/kis_saved_commands.h

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