Bug 381972

Summary: Krita crashes when trying to merge layers
Product: [Applications] krita Reporter: katearcher89
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: antti.savo, halla
Priority: NOR    
Version: 3.1.4   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:

Description katearcher89 2017-07-03 23:53:09 UTC
When merging a bunch of layers sorted in a certain way(and with different visibility set up) krita merge them in a wrong way and when undo is pressed krita crashes after a couple of seconds.

Steps to reproduce:
1. download the file: https://www.dropbox.com/s/t3m7wh80glr4yxd/so_79_krita_crash.kra?dl=0
(I've created the file specifically for this case, and I have similar and stable crashes on another file)
2. Select all the layers from "merge from this layer" to "to this", including group layer.
3. Press ctrl-e to merge 'em.
4. After the merge press ctrl-z to undo.
5. Krita crashes.

I have i7/16gb/gtx964 setup on windows 7 64bit and with this file got crash three out of three times I've tested it(with different layer structure results was not so consistent but still I was getting crashes pretty often).
Comment 1 Halla Rempt 2017-07-06 08:10:30 UTC
Hi,

Thanks for the report and the test file. I can confirm the issue:

SAFE ASSERT (krita): "node" in file /home/boud/dev/3.2/libs/ui/kis_node_filter_proxy_model.cpp, line 132
ASSERT (krita): "shape" in file /home/boud/dev/3.2/libs/ui/kis_node_manager.cpp, line 156

#0  0x00007fffed0c18d7 in raise () at /lib64/libc.so.6
#1  0x00007fffed0c2caa in abort () at /lib64/libc.so.6
#2  0x00007fffedd6921e in  () at /home/boud/dev/deps/lib64/libQt5Core.so.5
#3  0x00007ffff3c70f0c in kis_assert_common(char const*, char const*, int, bool, bool) (assertion=assertion@entry=0x7ffff7a436b3 "shape", file=file@entry=0x7ffff7a40ad0 "/home/boud/dev/3.2/libs/ui/kis_node_manager.cpp", line=line@entry=156, throwException=throwException@entry=false, isIgnorable=isIgnorable@entry=false)
    at /home/boud/dev/3.2/libs/global/kis_assert.cpp:90
#4  0x00007ffff3c7126a in kis_assert_recoverable(char const*, char const*, int) (assertion=assertion@entry=0x7ffff7a436b3 "shape", file=file@entry=0x7ffff7a40ad0 "/home/boud/dev/3.2/libs/ui/kis_node_manager.cpp", line=line@entry=156) at /home/boud/dev/3.2/libs/global/kis_assert.cpp:103
#5  0x00007ffff76db400 in KisNodeManager::Private::activateNodeImpl(KisSharedPtr<KisNode>) (this=0x65e7d10, node=...) at /home/boud/dev/3.2/libs/ui/kis_node_manager.cpp:156
#6  0x00007ffff76db693 in KisNodeManager::slotSomethingActivatedNodeImpl(KisSharedPtr<KisNode>) (this=this@entry=0x65b9828, node=...) at /home/boud/dev/3.2/libs/ui/kis_node_manager.cpp:586
#7  0x00007ffff76db8b6 in KisNodeManager::slotNonUiActivatedNode(KisSharedPtr<KisNode>) (this=this@entry=0x65b9828, node=...) at /home/boud/dev/3.2/libs/ui/kis_node_manager.cpp:602
#8  0x00007ffff76dba15 in KisNodeManager::slotImageRequestNodeReselection(KisSharedPtr<KisNode>, QList<KisSharedPtr<KisNode> > const&) (this=this@entry=0x65b9828, activeNode=..., selectedNodes=...)
    at /home/boud/dev/3.2/libs/ui/kis_node_manager.cpp:712
#9  0x00007ffff797aafc in KisNodeManager::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x65b9828, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>)
    at /home/boud/dev/b-3.2/libs/ui/moc_kis_node_manager.cpp:351
#10 0x00007fffedf783d1 in QMetaObject::activate(QObject*, int, int, void**) ()
    at /home/boud/dev/deps/lib64/libQt5Core.so.5
#11 0x00007ffff68228aa in KisImage::sigRequestNodeReselection(KisSharedPtr<KisNode>, QList<KisSharedPtr<KisNode> > const&) (this=<optimized out>, _t1=..., _t2=...) at /home/boud/dev/b-3.2/libs/image/moc_kis_image.cpp:668
#12 0x00007ffff6824ff7 in KisImage::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=0x7fffffffc910)
    at /home/boud/dev/b-3.2/libs/image/moc_kis_image.cpp:300
#13 0x00007fffedf783d1 in QMetaObject::activate(QObject*, int, int, void**) ()
    at /home/boud/dev/deps/lib64/libQt5Core.so.5
#14 0x00007ffff6822d9a in KisImageSignalRouter::sigRequestNodeReselection(KisSharedPtr<KisNode>, QList<KisSharedPtr<KisNode> > const&) (this=this@entry=0x7224b30, _t1=..., _t2=...)
    at /home/boud/dev/b-3.2/libs/image/moc_kis_image_signal_router.cpp:309
#15 0x00007ffff6710ed8 in KisImageSignalRouter::slotNotification(KisImageSignalType) (this=this@entry=0x7224b30, type=...) at /home/boud/dev/3.2/libs/image/kis_image_signal_router.cpp:142
#16 0x00007ffff682482e in KisImageSignalRouter::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x7224b30, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>)
    at /home/boud/dev/b-3.2/libs/image/moc_kis_image_signal_router.cpp:142
#17 0x00007fffedf79986 in QObject::event(QEvent*) () at /home/boud/dev/deps/lib64/libQt5Core.so.5
#18 0x00007fffeef3edec in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
    at /home/boud/dev/deps/lib64/libQt5Widgets.so.5
#19 0x00007fffeef4344a in QApplication::notify(QObject*, QEvent*) ()
    at /home/boud/dev/deps/lib64/libQt5Widgets.so.5
#20 0x00007ffff78b9547 in KisApplication::notify(QObject*, QEvent*) (this=<optimized out>, receiver=0x7224b30, event=0x7fffb834aa60) at /home/boud/dev/3.2/libs/ui/KisApplication.cpp:543
#21 0x00007fffedf4e925 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
    at /home/boud/dev/deps/lib64/libQt5Core.so.5
#22 0x00007fffedf5070a in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
    at /home/boud/dev/deps/lib64/libQt5Core.so.5
#23 0x00007fffedf9f2e3 in  () at /home/boud/dev/deps/lib64/libQt5Core.so.5
#24 0x00007fffeb0ab134 in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0
#25 0x00007fffeb0ab388 in  () at /usr/lib64/libglib-2.0.so.0
#26 0x00007fffeb0ab42c in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
#27 0x00007fffedf9e96c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /home/boud/dev/deps/lib64/libQt5Core.so.5
#28 0x00007fffedf4cacb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /home/boud/dev/deps/lib64/libQt5Core.so.5
#29 0x00007fffedf54806 in QCoreApplication::exec() () at /home/boud/dev/deps/lib64/libQt5Core.so.5
#30 0x00000000004055bb in main(int, char**) (argc=1, argv=<optimized out>)
    at /home/boud/dev/3.2/krita/main.cc:26
Comment 2 Halla Rempt 2017-07-07 12:31:06 UTC
Git commit d1f8b5173c75480e1d52fb820bf4bbac9ef643d6 by Boudewijn Rempt.
Committed on 07/07/2017 at 12:30.
Pushed by rempt into branch 'krita/3.2'.

Use safe asserts here

When undoing a layer merge, there's a fair chance that there aren't
any shapes yet, so don't hard assert if that's the case.

M  +6    -3    libs/ui/kis_node_manager.cpp

https://commits.kde.org/krita/d1f8b5173c75480e1d52fb820bf4bbac9ef643d6
Comment 3 Halla Rempt 2017-07-07 12:42:49 UTC
Git commit 345235c75b4ab7ea0b0663a1710228907024760c by Boudewijn Rempt.
Committed on 07/07/2017 at 12:42.
Pushed by rempt into branch 'master'.

Use safe asserts here

When undoing a layer merge, there's a fair chance that there aren't
any shapes yet, so don't hard assert if that's the case.

M  +5    -2    libs/ui/kis_node_manager.cpp

https://commits.kde.org/krita/345235c75b4ab7ea0b0663a1710228907024760c
Comment 4 Antti Savolainen 2018-06-26 17:35:48 UTC
The crash seems to be fixed but the merging is still odd. It merges all the layers to a single one even the ones that aren't selected.
Comment 5 Antti Savolainen 2018-06-26 20:30:01 UTC
I'll close this since the original crash was fixed and the odd behavior was reported separately.