Bug 376596 - crash while removing frames in the animation timeline
Summary: crash while removing frames in the animation timeline
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Animation (show other bugs)
Version: 3.1.2
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-17 21:06 UTC by z-uo
Modified: 2017-04-19 17:04 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description z-uo 2017-02-17 21:06:33 UTC
I have a kra file who crash every times I try to remove like 10 frames on a specific layer. 
Its a file with 8 animation layer and 30 frames on each.
I wanted to attach the file with the bug repport but I make a copy of the kra file with my file manager and try the same operation, it doesn't crash, I retried the first file who still crash.

I suspect something with the cache.
I'm not sure its enough information for you to investigate?

I'm using the ppa on ubuntu.
Comment 1 z-uo 2017-02-17 21:24:31 UTC
okay after a few more test it crash every times with the copy of the file, so I've put it here https://nicolasbougere.cozycloud.cc/public/files/files/ab1e8a58e2a31d9afca2b473858ce0c6/attach/sdggxcbxcvxcv.kra
I also tried with the krita appimage with the same result
The step are (in the timeline) in the layer "jambe droite" select the frame 33 
with shift select the frame 11
right clic and remove frame
then it crash

If you first select the frame 11 then the 33 it works just fine...
Comment 2 Halla Rempt 2017-02-27 13:58:17 UTC
I suspect that this was caused by cleanup some usage of shared pointers. I can confirm the crash:

#0  0x00007ffff6294793 in KisPaintDevice::Private::transferFromData(KisPaintDeviceData*, KisSharedPtr<KisPaintDevice>) (this=this@entry=0x7b01fe0, data=0x0, targetDevice=...)
    at /home/boud/dev/krita/libs/image/kis_paint_device.cc:753
#1  0x00007ffff62948f5 in KisPaintDevice::Private::fetchFrame(int, KisSharedPtr<KisPaintDevice>) (this=0x7b01fe0, frameId=18, targetDevice=...) at /home/boud/dev/krita/libs/image/kis_paint_device.cc:763
#2  0x00007ffff6294955 in KisPaintDeviceFramesInterface::fetchFrame(int, KisSharedPtr<KisPaintDevice>) (this=<optimized out>, frameId=frameId@entry=18, targetDevice=...)
    at /home/boud/dev/krita/libs/image/kis_paint_device.cc:2003
#3  0x00007ffff632873b in KisRasterKeyframeChannel::fetchFrame(QSharedPointer<KisKeyframe>, KisSharedPtr<KisPaintDevice>) (this=this@entry=0x85b1790, keyframe=..., targetDevice=...)
    at /home/boud/dev/krita/libs/image/kis_raster_keyframe_channel.cpp:102
#4  0x00007ffff632dcc4 in KisOnionSkinCompositor::composite(KisSharedPtr<KisPaintDevice>, KisSharedPtr<KisPaintDevice>, QRect const&) (rect=..., opacity=91, tintSource=..., 
    gcDest=..., gcFrame=..., keyframe=..., keyframes=0x85b1790, this=<optimized out>)
    at /home/boud/dev/krita/libs/image/kis_onion_skin_compositor.cpp:80
#5  0x00007ffff632dcc4 in KisOnionSkinCompositor::composite(KisSharedPtr<KisPaintDevice>, KisSharedPtr<KisPaintDevice>, QRect const&) (this=this@entry=0x7ffff6634db0 <_ZZN12_GLOBAL__N_116Q_QGS_s_instance13innerFunctionEvE6holder>, sourceDevice=..., targetDevice=..., rect=...)
    at /home/boud/dev/krita/libs/image/kis_onion_skin_compositor.cpp:170
#6  0x00007ffff632e928 in KisOnionSkinCache::projection(KisSharedPtr<KisPaintDevice>) (this=0x7aff970, source=...) at /home/boud/dev/krita/libs/image/kis_onion_skin_cache.cpp:99
#7  0x00007ffff62a4f0c in KisPaintLayer::copyOriginalToProjection(KisSharedPtr<KisPaintDevice>, KisSharedPtr<KisPaintDevice>, QRect const&) const (this=0x7b01880, original=..., projection=..., rect=...)
    at /home/boud/dev/krita/libs/image/kis_paint_layer.cc:168
#8  0x00007ffff625f717 in KisLayer::applyMasks(KisSharedPtr<KisPaintDevice>, KisSharedPtr<KisPaintDevice>, QRect const&, KisSharedPtr<KisNode>, KisSharedPtr<KisNode>) const (this=this@entry=0x7b01880, source=..., destination=..., requestedRect=..., filthyNode=..., lastNode=...) at /home/boud/dev/krita/libs/image/kis_layer.cc:594
#9  0x00007ffff62603f7 in KisLayer::updateProjection(QRect const&, KisSharedPtr<KisNode>) (this=0x7b01880, rect=..., filthyNode=...) at /home/boud/dev/krita/libs/image/kis_layer.cc:684
#10 0x00007ffff6263538 in KisLayerProjectionPlane::recalculate(QRect const&, KisSharedPtr<KisNode>) (this=<optimized out>, rect=..., filthyNode=...) at /home/boud/dev/krita/libs/image/kis_layer_projection_plane.cpp:47
#11 0x00007ffff6222834 in KisAsyncMerger::startMerge(KisBaseRectsWalker&, bool) (this=this@entry=0x7a3dda0, walker=..., notifyClones=notifyClones@entry=true) at /home/boud/dev/krita/libs/image/kis_async_merger.cpp:251
#12 0x00007ffff6368dd3 in KisUpdateJobItem::run() (this=0x7a3dd60)
    at /home/boud/dev/build/libs/image/kritaimage_automoc.dir/../../../../krita/libs/image/kis_update_job_item.h:83
#13 0x00007ffff6368dd3 in KisUpdateJobItem::run() (this=0x7a3dd60)
    at /home/boud/dev/build/libs/image/kritaimage_automoc.dir/../../../../krita/libs/image/kis_update_job_item.h:63
#14 0x00007fffeded15fe in  () at /home/boud/dev/deps/lib/libQt5Core.so.5
#15 0x00007fffeded4609 in  () at /home/boud/dev/deps/lib/libQt5Core.so.5
#16 0x00007fffecfcb0a4 in start_thread () at /lib64/libpthread.so.0
#17 0x00007fffed2c502d in clone () at /lib64/libc.so.6
Comment 3 Dmitry Kazakov 2017-04-18 12:07:39 UTC
The problem is more general. The animation actions do not care about strokes and locking. Therefore the frame is removed while some update or animation cache regenerator is accessing the image frames.
Comment 4 Dmitry Kazakov 2017-04-19 16:49:22 UTC
Git commit 17a922c5576ba217bcb450e6ae6c9ad04fec35b2 by Dmitry Kazakov.
Committed on 19/04/2017 at 16:49.
Pushed by dkazakov into branch 'master'.

Port animation frames commands to use strokes

The system is not ideal, we have to use lambda commands coupled
with SkipFirstRedoWrapper. The problem is that our animation
framework returns "post-execution" commands. That is, it first modifies
the object and then returns the command for undoing this.

In the future we should refactor the animation system not to do this
post-execution thing, but just return commands for doing the work. Then
the code will be a bit simplified.

M  +45   -2    libs/command/kis_command_utils.cpp
M  +37   -1    libs/command/kis_command_utils.h
M  +10   -0    libs/image/kis_processing_applicator.cpp
M  +13   -0    libs/image/kis_processing_applicator.h
M  +2    -1    libs/ui/KisImageBarrierLockerWithFeedback.h
M  +58   -18   plugins/dockers/animation/kis_animation_curves_model.cpp
M  +140  -109  plugins/dockers/animation/kis_animation_utils.cpp
M  +12   -7    plugins/dockers/animation/kis_animation_utils.h
M  +36   -31   plugins/dockers/animation/kis_time_based_item_model.cpp
M  +3    -1    plugins/dockers/animation/kis_time_based_item_model.h
M  +4    -13   plugins/dockers/animation/timeline_frames_model.cpp

https://commits.kde.org/krita/17a922c5576ba217bcb450e6ae6c9ad04fec35b2
Comment 5 Dmitry Kazakov 2017-04-19 17:04:22 UTC
Git commit c2d5d8a41f3cc65f1200905ffefa175c1e029fa4 by Dmitry Kazakov.
Committed on 19/04/2017 at 17:03.
Pushed by dkazakov into branch 'krita/3.1'.

Port animation frames commands to use strokes

The system is not ideal, we have to use lambda commands coupled
with SkipFirstRedoWrapper. The problem is that our animation
framework returns "post-execution" commands. That is, it first modifies
the object and then returns the command for undoing this.

In the future we should refactor the animation system not to do this
post-execution thing, but just return commands for doing the work. Then
the code will be a bit simplified.

M  +45   -2    libs/image/kis_command_utils.cpp
M  +37   -1    libs/image/kis_command_utils.h
M  +10   -0    libs/image/kis_processing_applicator.cpp
M  +13   -0    libs/image/kis_processing_applicator.h
M  +2    -1    libs/ui/KisImageBarrierLockerWithFeedback.h
M  +58   -18   plugins/dockers/animation/kis_animation_curves_model.cpp
M  +140  -109  plugins/dockers/animation/kis_animation_utils.cpp
M  +12   -7    plugins/dockers/animation/kis_animation_utils.h
M  +36   -31   plugins/dockers/animation/kis_time_based_item_model.cpp
M  +3    -1    plugins/dockers/animation/kis_time_based_item_model.h
M  +4    -13   plugins/dockers/animation/timeline_frames_model.cpp

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