Bug 452396 - Crash when deleting a vector layer that has an animated mask
Summary: Crash when deleting a vector layer that has an animated mask
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Unclassified
Component: Animation (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Debian stable Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-08 10:16 UTC by Ahab Greybeard
Modified: 2022-04-26 21:52 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Test file with vector shapes and all animated masks (929.08 KB, application/x-krita)
2022-04-08 10:16 UTC, Ahab Greybeard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ahab Greybeard 2022-04-08 10:16:36 UTC
Created attachment 148040 [details]
Test file with vector shapes and all animated masks

SUMMARY
This bug was introduced in the Apr 07 5.1.0-prealpha (git d3c7ecdf5e) appimage.

A test file, 'vector-shapes-all-anim-masks.kra', is attached for convenience of testing.

STEPS TO REPRODUCE
1. Open the attached test file.
2. Select and turn on the visibility of either the 'Vector-Rectangles' layer, the 'Vector-Ellipses' layer or the 'Vector-Circle' layer and note the animated mask on it.
3. Delete the selected vector layer.

OBSERVED RESULT
3. A Crash with 'Segmentation fault' reported in the terminal.

This also happens for vector text.
This does not happen with static masks.
This does not happen with paint layers that have animated masks on them.

EXPECTED RESULT
3. No crash, vector layer and its mask deleted.3. No crash, vector layer and its mask deleted. No crash, vector layer and its mask deleted.

SOFTWARE/OS VERSIONS
Krita

 Version: 5.1.0-prealpha (git d3c7ecd)
 Languages: en_GB, en, en, en_GB, en
 Hidpi: false

Qt

  Version (compiled): 5.12.12
  Version (loaded): 5.12.12

OS Information

  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 4.19.0-20-amd64
  Pretty Productname: Debian GNU/Linux 10 (buster)
  Product Type: debian
  Product Version: 10
  Desktop: MATE
Comment 1 Ahab Greybeard 2022-04-18 15:57:33 UTC
Clarification - For the initial report, I was using right-click -> Remove Layer.
Further investigation shows:

This still happens with the Apr 17 5.1.0-prealpha (git 4205530a30) appimage on Debian 10.

right-click -> Remove Layer - will crash immediately.

Shift+Del - may need two or three uses to induce a crash.

The Wastebin icon ('Delete the layer or mask') only causes a crash if used on the 'Vector Circle' (with animatedTransform mask).
Comment 2 sh_zam 2022-04-21 13:16:07 UTC
Confirming, backtrace: 

Thread 1 "krita" received signal SIGSEGV, Segmentation fault.
KoColorSpace::channelFlags (this=0x0, color=false, alpha=true) at /home/sh_zam/workspace/krita/libs/pigment/KoColorSpace.cpp:295
295         QBitArray ba(d->channels.size());
(gdb) bt
#0  KoColorSpace::channelFlags(bool, bool) const (this=0x0, color=false, alpha=true) at /home/sh_zam/workspace/krita/libs/pigment/KoColorSpace.cpp:295
#1  0x00007ffff73da066 in KisLayer::alphaChannelDisabled() const (this=this@entry=0x55555cd701a0) at /home/sh_zam/workspace/krita/libs/image/kis_layer.cc:334
#2  0x00007ffff73d9e37 in KisLayer::sectionModelProperties() const (this=0x55555cd701a0) at /home/sh_zam/workspace/krita/libs/image/kis_layer.cc:290
#3  0x00007fffb03c7ffc in KisAnimTimelineFramesModel::Private::layerProperties(int) const (this=<optimized out>, row=<optimized out>) at /home/sh_zam/workspace/krita/plugins/dockers/animation/KisAnimTimelineFramesModel.cpp:166
#4  0x00007fffb03c1084 in KisAnimTimelineFramesModel::headerData(int, Qt::Orientation, int) const (this=<optimized out>, section=0, orientation=<optimized out>, role=1141331200) at /home/sh_zam/workspace/krita/plugins/dockers/animation/KisAnimTimelineFramesModel.cpp:505
#5  0x00007fffb03db97c in KisAnimTimelineLayersHeader::Private::numIcons(int) const (this=<optimized out>, logicalIndex=logicalIndex@entry=0) at /home/sh_zam/workspace/krita/plugins/dockers/animation/KisAnimTimelineLayersHeader.cpp:156
#6  0x00007fffb03dbc78 in KisAnimTimelineLayersHeader::Private::iconSectionWidth(int) const (this=0x7fffffffcab0, layerIndex=0) at /home/sh_zam/workspace/krita/plugins/dockers/animation/KisAnimTimelineLayersHeader.cpp:174
#7  KisAnimTimelineLayersHeader::sectionSizeFromContents(int) const (this=0x55555cec19e0, layerIndex=0) at /home/sh_zam/workspace/krita/plugins/dockers/animation/KisAnimTimelineLayersHeader.cpp:190
#8  0x00007ffff508cd59 in QHeaderView::sizeHint() const () at /usr/lib/libQt5Widgets.so.5
#9  0x00007ffff50d4177 in QTableView::updateGeometries() () at /usr/lib/libQt5Widgets.so.5
#10 0x00007fffb03ce5d3 in KisAnimTimelineFramesView::updateGeometries() (this=0x55555ceb6820) at /home/sh_zam/workspace/krita/plugins/dockers/animation/KisAnimTimelineFramesView.cpp:449
#11 0x00007ffff507c592 in QAbstractItemView::doItemsLayout() () at /usr/lib/libQt5Widgets.so.5
#12 0x00007ffff50cc2af in QTableView::doItemsLayout() () at /usr/lib/libQt5Widgets.so.5
#13 0x00007ffff50d658b in QTableView::visualRect(QModelIndex const&) const () at /usr/lib/libQt5Widgets.so.5
#14 0x00007ffff5088c7e in QAbstractItemView::update(QModelIndex const&) () at /usr/lib/libQt5Widgets.so.5
#15 0x00007ffff5089784 in QAbstractItemView::currentChanged(QModelIndex const&, QModelIndex const&) () at /usr/lib/libQt5Widgets.so.5
#16 0x00007fffb03d5899 in KisAnimTimelineFramesView::currentChanged(QModelIndex const&, QModelIndex const&) (this=0x55555ceb6820, current=..., previous=...) at /home/sh_zam/workspace/krita/plugins/dockers/animation/KisAnimTimelineFramesView.cpp:1389
#17 0x00007fffb03cfe3a in KisAnimTimelineFramesView::slotReselectCurrentIndex() (this=0x55555ceb6820) at /home/sh_zam/workspace/krita/plugins/dockers/animation/KisAnimTimelineFramesView.cpp:575
#18 0x00007fffb03a50ca in KisAnimTimelineFramesView::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x7fffffffcab0, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffffffd0c0) at plugins/dockers/animation/kritaanimationdocker_autogen/EWIEGA46WW/moc_KisAnimTimelineFramesView.cpp:328
#19 0x00007ffff43cd4af in  () at /usr/lib/libQt5Core.so.5
#20 0x00007ffff4358d83 in QAbstractItemModel::rowsRemoved(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal) () at /usr/lib/libQt5Core.so.5
#21 0x00007ffff435378e in QAbstractItemModel::endRemoveRows() () at /usr/lib/libQt5Core.so.5
#22 0x00007fffb0401dfc in TimelineNodeListKeeper::ModelWithExternalNotifications::callEndRemoveRows() (this=0x7fffffffcab0) at /home/sh_zam/workspace/krita/plugins/dockers/animation/timeline_node_list_keeper.h:82
#23 TimelineNodeListKeeper::slotBeginRemoveDummy(KisNodeDummy*) (this=0x5555608641e0, dummy=0x55555f8387d0) at /home/sh_zam/workspace/krita/plugins/dockers/animation/timeline_node_list_keeper.cpp:201
#24 0x00007ffff43cd4af in  () at /usr/lib/libQt5Core.so.5
#25 0x00007ffff7a16110 in KisDummiesFacadeBase::sigBeginRemoveDummy(KisNodeDummy*) (this=0x7fffffffcab0, _t1=0x55555f8387d0) at libs/ui/kritaui_autogen/QUY67KCZCL/moc_kis_dummies_facade_base.cpp:248
#26 0x00007ffff7b04502 in KisDummiesFacadeBase::slotContinueRemoveNode(KisSharedPtr<KisNode>) (this=0x5555575aca00, node=...) at /home/sh_zam/workspace/krita/libs/ui/flake/kis_dummies_facade_base.cpp:195
#27 0x00007ffff7b07023 in boost::_mfi::mf1<void, KisDummiesFacadeBase, KisSharedPtr<KisNode> >::operator()(KisDummiesFacadeBase*, KisSharedPtr<KisNode>) const (this=<optimized out>, p=<optimized out>, a1=...) at /usr/include/boost/bind/mem_fn_template.hpp:165
#28 boost::_bi::list2<boost::_bi::value<KisDummiesFacadeBase*>, boost::arg<1> >::operator()<boost::_mfi::mf1<void, KisDummiesFacadeBase, KisSharedPtr<KisNode> >, boost::_bi::rrlist1<KisSharedPtr<KisNode> > >(boost::_bi::type<void>, boost::_mfi::mf1<void, KisDummiesFacadeBase, KisSharedPtr<KisNode> >&, boost::_bi::rrlist1<KisSharedPtr<KisNode> >&, int) (this=<optimized out>, f=<optimized out>, a=<optimized out>) at /usr/include/boost/bind/bind.hpp:298
#29 boost::_bi::bind_t<void, boost::_mfi::mf1<void, KisDummiesFacadeBase, KisSharedPtr<KisNode> >, boost::_bi::list2<boost::_bi::value<KisDummiesFacadeBase*>, boost::arg<1> > >::operator()<KisSharedPtr<KisNode> >(KisSharedPtr<KisNode>&&) (this=<optimized out>, a1=<optimized out>) at /usr/include/boost/bind/bind.hpp:1285
#30 0x00007ffff7b0651c in std::function<void (KisSharedPtr<KisNode>)>::operator()(KisSharedPtr<KisNode>) const (this=0x7fffffffd328, __args=...) at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../include/c++/11.2.0/bits/std_function.h:560
#31 kismpl::detail::apply_impl<std::function<void (KisSharedPtr<KisNode>)>, std::tuple<KisSharedPtr<KisNode> >&, 0ul>(std::function<void (KisSharedPtr<KisNode>)>, std::tuple<KisSharedPtr<KisNode> >&, std::integer_sequence<unsigned long, 0ul>) (f=..., t=std::tuple containing = {...}) at /home/sh_zam/workspace/krita/libs/global/KisMpl.h:22
#32 kismpl::apply<std::function<void (KisSharedPtr<KisNode>)>&, std::tuple<KisSharedPtr<KisNode> >&>(std::function<void (KisSharedPtr<KisNode>)>&, std::tuple<KisSharedPtr<KisNode> >&) (f=<optimized out>, t=std::tuple containing = {...}) at /home/sh_zam/workspace/krita/libs/global/KisMpl.h:37
#33 0x00007ffff7b06094 in KisSynchronizedConnection<KisSharedPtr<KisNode> >::deliverEventToReceiver() (this=<optimized out>) at /home/sh_zam/workspace/krita/libs/global/KisSynchronizedConnection.h:222
#34 0x00007ffff62463ac in KisSynchronizedConnectionBase::event(QEvent*) (this=0x55555790c460, event=0x7fff4402d980) at /home/sh_zam/workspace/krita/libs/global/KisSynchronizedConnection.cpp:77
#35 0x00007ffff4e1b1c6 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#36 0x00007ffff7e568fe in KisApplication::notify(QObject*, QEvent*) (this=0x7fffffffd948, receiver=0x55555790c460, event=0x7fff4402d980) at /home/sh_zam/workspace/krita/libs/ui/KisApplication.cpp:755
#37 0x00007ffff439c5aa in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#38 0x00007ffff439d0a9 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/libQt5Core.so.5
#39 0x00007ffff43e4678 in  () at /usr/lib/libQt5Core.so.5
#40 0x00007ffff2a2c163 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#41 0x00007ffff2a829e9 in  () at /usr/lib/libglib-2.0.so.0
#42 0x00007ffff2a296c5 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#43 0x00007ffff43e857a in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#44 0x00007ffff439488b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#45 0x00007ffff439ffd7 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#46 0x0000555555bf09a6 in main(int, char**) (argc=<optimized out>, argv=0x7fffffffdaf8) at /home/sh_zam/workspace/krita/krita/main.cc:702
Comment 3 Eoin O'Neill 2022-04-26 21:50:41 UTC
Git commit 62afc6d92a54ff664e16a8439a18f4f0efa6d6e4 by Eoin O'Neill.
Committed on 26/04/2022 at 21:50.
Pushed by eoinoneill into branch 'master'.

Add safe assert on colorspace missing when fetching layer property for alphaChannelDisable.

Fixes a user-level crash when deleting a Vector layer with an animated transparency mask.
Notably, this shouldn't be null, so I'm leaving a safe assert -- but a safe assert is
better than a hard crash for now.

M  +1    -0    libs/image/kis_layer.cc

https://invent.kde.org/graphics/krita/commit/62afc6d92a54ff664e16a8439a18f4f0efa6d6e4
Comment 4 Eoin O'Neill 2022-04-26 21:52:13 UTC
Git commit 54fef37e2f086cfff6e830604c83bb6713421407 by Eoin O'Neill.
Committed on 26/04/2022 at 21:52.
Pushed by eoinoneill into branch 'krita/5.0'.

Add safe assert on colorspace missing when fetching layer property for alphaChannelDisable.

Fixes a user-level crash when deleting a Vector layer with an animated transparency mask.
Notably, this shouldn't be null, so I'm leaving a safe assert -- but a safe assert is
better than a hard crash for now.


(cherry picked from commit 62afc6d92a54ff664e16a8439a18f4f0efa6d6e4)

M  +1    -0    libs/image/kis_layer.cc

https://invent.kde.org/graphics/krita/commit/54fef37e2f086cfff6e830604c83bb6713421407