Bug 454547

Summary: Crash when changing filter layer opacity
Product: [Applications] krita Reporter: deletesomenames
Component: AnimationAssignee: Emmet O'Neill <emmetoneill.pdx>
Status: RESOLVED FIXED    
Severity: crash CC: ahab.greybeard, emmetoneill.pdx, eoinoneill1991, halla
Priority: NOR    
Version: 5.0.6   
Target Milestone: ---   
Platform: Other   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Attachments: Filter layer crash reproduction case

Description deletesomenames 2022-05-29 03:45:25 UTC
Created attachment 149301 [details]
Filter layer crash reproduction case

SUMMARY
I copied an HSV adjustment layer from one file to another.  This produced some sort of invalid layer that crashes every time the opacity is adjusted.  It has something to do with the animation key frames on the layer - if you delete the keyframes first, there is no crash.

STEPS TO REPRODUCE
1.  Open the attached file
2.  Adjust the opacity of the filter layer
3.  Crash

OBSERVED RESULT
Crash

EXPECTED RESULT
No crash ;)

SOFTWARE/OS VERSIONS
Windows 7, Krita 5.0.6
Comment 1 Ahab Greybeard 2022-06-03 11:29:39 UTC
I can Confirm this crash with the 5.0.6 appimage and the Jun 02 5.1.0-prealpha (git 49171d80dc) appimages.

It seems to be caused by 'internal logic' not taking account of the situation.
The Filter Layer has opacity keyframes on it and the first one is not at frame-0.

If you select a frame and change the opacity of the layer in the Layers docker then the opacity keyframe value is changed for that layer, if it has an opacity keyframe on it.
If it does not have an opacity keyframe on it then the previous opacity keyframe value is changed.

For this layer, and similarly constructed layers, if you select a frame that is before the first defined opacity keyframe then there is no previous opacity keyframe and it crashes.

The same thing happens for a paint layer with opacity keyframes on it (and probably other types of layers that can have opacity keyframes on them).
Comment 2 Halla Rempt 2022-06-24 13:48:49 UTC
[Switching to Thread 0x7fff85ffb700 (LWP 730668)]
KisScalarKeyframe::value (this=this@entry=0x0)
    at /home/halla/dev/krita/libs/image/kis_scalar_keyframe_channel.cpp:57
57          return m_value;
(gdb) 
(gdb) bt
#0  KisScalarKeyframe::value (this=this@entry=0x0)
    at /home/halla/dev/krita/libs/image/kis_scalar_keyframe_channel.cpp:57
#1  0x00007ffff6db8cd7 in KisAnimatedOpacityProperty::set (this=0x55555df051f8, value=<optimized out>)
    at /home/halla/dev/krita/libs/image/KisAnimatedOpacityProperty.cpp:36
#2  0x00007ffff6ed5085 in KisBaseNode::setOpacity (this=<optimized out>, val=<optimized out>)
    at /home/halla/dev/krita/libs/image/kis_base_node.cpp:119
#3  0x00007ffff6e0784d in KisNodeOpacityCommand::redo (this=0x55555dfbc580)
    at /home/halla/dev/krita/libs/image/commands/kis_node_opacity_command.cpp:25
#4  0x00007ffff6f6c2de in KisStrokeStrategyUndoCommandBased::doStrokeCallback (this=0x55555db33c80, 
    data=0x5555568b3640) at /home/halla/dev/krita/libs/image/kis_stroke_strategy_undo_command_based.cpp:125
#5  0x00007ffff6d54547 in KisStrokeJob::run (this=<optimized out>)
    at /home/halla/dev/b-krita/libs/image/kritaimage_autogen/EWIEGA46WW/../../../../../krita/libs/image/kis_stroke_job.h:32
#6  KisUpdateJobItem::runImpl (this=0x555557761ea0)
    at /home/halla/dev/b-krita/libs/image/kritaimage_autogen/EWIEGA46WW/../../../../../krita/libs/image/kis_update_job_item.h:100
#7  KisUpdateJobItem::run (this=0x555557761ea0)
    at /home/halla/dev/b-krita/libs/image/kritaimage_autogen/EWIEGA46WW/../../../../../krita/libs/image/kis_update_job_item.h:49
#8  0x00007ffff57e0b72 in ?? () from /home/halla/dev/deps/lib/libQt5Core.so.5
#9  0x00007ffff57dd592 in ?? () from /home/halla/dev/deps/lib/libQt5Core.so.5
#10 0x00007ffff3c72609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#11 0x00007ffff53f4133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Comment 3 Emmet O'Neill 2022-06-29 03:36:44 UTC
Git commit bc552ba0f327d3ff2ee39f99373bc70936b0bdb5 by Emmet O'Neill.
Committed on 29/06/2022 at 03:36.
Pushed by emmetoneill into branch 'master'.

Animation Curves: Fixed crash when setting opacity keyframe on copied
layer.

M  +12   -8    libs/image/KisAnimatedOpacityProperty.cpp

https://invent.kde.org/graphics/krita/commit/bc552ba0f327d3ff2ee39f99373bc70936b0bdb5
Comment 4 Eoin O'Neill 2022-06-29 22:16:49 UTC
Git commit 0400ca67da5ce9b08e76be9b334f74e601be8bef by Eoin O'Neill, on behalf of Emmet O'Neill.
Committed on 29/06/2022 at 22:16.
Pushed by eoinoneill into branch 'krita/5.1'.

Animation Curves: Fixed crash when setting opacity keyframe on copied
layer.
(cherry picked from commit bc552ba0f327d3ff2ee39f99373bc70936b0bdb5)

M  +12   -8    libs/image/KisAnimatedOpacityProperty.cpp

https://invent.kde.org/graphics/krita/commit/0400ca67da5ce9b08e76be9b334f74e601be8bef