Bug 476511 - Inconsistent undo and redo after flattening a layer
Summary: Inconsistent undo and redo after flattening a layer
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Animation (show other bugs)
Version: 5.2.1
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-03 15:29 UTC by paleh
Modified: 2023-11-05 13:11 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
screen recording of the bug on 5.2.1-f819e29 (1.01 MB, video/webm)
2023-11-03 17:39 UTC, paleh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description paleh 2023-11-03 15:29:06 UTC
SUMMARY
Canvas isn't properly updated when undoing and redoing a flattening of a layer.

STEPS TO REPRODUCE
1. Add a new frame on a paint layer
2. Draw something on it
3. Add a mask (filter, transparency,...) to this layer.
4. Flatten the animated layer.
5. Press undo
6. Press redo

OBSERVED RESULT
The layer disappears. Repeating steps 5-6 brings it back.

EXPECTED RESULT
After step 6 the canvas returns to its state after step 4.

SOFTWARE/OS VERSIONS
Linux: Ubuntu 22.04
Qt Version: 5.15.7
Appimage

ADDITIONAL INFORMATION
It's probably related to bug 474122. I'm creating this ticket because there it's phrased as a "warning", whereas here this is a concrete error.
Comment 1 Dmitry Kazakov 2023-11-03 15:55:24 UTC
Hi, paleh!

Thank you for the report! The bug seems to be fixed by the patch I pushed in the morning!

Please try this build:
https://binary-factory.kde.org/job/Krita_Stable_Windows_Build/2034/

*** This bug has been marked as a duplicate of bug 476495 ***
Comment 2 paleh 2023-11-03 16:03:52 UTC
Hi, Dmitry

Err, which build is it? I can reproduce the bug on 5.2.1-8a2e4c8b0e which you pushed today (at 12:01pm CET) in response to my other bug report.
Comment 3 Dmitry Kazakov 2023-11-03 16:36:55 UTC
Well, that is the same build. I'll recheck then
Comment 4 Dmitry Kazakov 2023-11-03 17:08:19 UTC
Hi, paleh!

I have restarted the build. Could you try this one when it is ready?

https://binary-factory.kde.org/job/Krita_Stable_Windows_Build/2035/

It might be related to the race condition I fixed for another report of yours :)
Comment 5 paleh 2023-11-03 17:39:50 UTC
Created attachment 162846 [details]
screen recording of the bug on 5.2.1-f819e29

No, nothing changed with the stable windows build #2035. I recorded a video to demonstrate it. Since it was only a Windows build that you restarted, and because I don't currently have a windows VM, I tested it in Wine, but the result is the same is the same for the stable appimage build #2040.
Comment 6 Bug Janitor Service 2023-11-04 03:45:50 UTC
Thanks for your comment!

Automatically switching the status of this bug to REPORTED so that the KDE team
knows that the bug is ready to get confirmed.

In the future you may also do this yourself when providing needed information.
Comment 7 Dmitry Kazakov 2023-11-05 12:33:50 UTC
Hi, paleh!

Thank you for the video! I can reproduce the issue now! :)
Comment 8 Dmitry Kazakov 2023-11-05 13:08:34 UTC
Git commit 5537f00ef0973e2887eee31143ec3aa67e3b7e19 by Dmitry Kazakov.
Committed on 05/11/2023 at 14:08.
Pushed by dkazakov into branch 'master'.

Fix redo of a flatten layer operation when it is animated

KisKeyFrameChannel already wraps the command into SkipFirstRedoWrapper,
so there is no need for another one.

This is a regression from 933c1fa041d97a23701e709eec8a9417f9a26fec

M  +3    -3    libs/image/kis_layer_utils.cpp

https://invent.kde.org/graphics/krita/-/commit/5537f00ef0973e2887eee31143ec3aa67e3b7e19
Comment 9 Dmitry Kazakov 2023-11-05 13:11:13 UTC
Git commit 7eb718c2543ab120487e1916c6f8d01157ca02f3 by Dmitry Kazakov.
Committed on 05/11/2023 at 14:09.
Pushed by dkazakov into branch 'krita/5.2'.

Fix redo of a flatten layer operation when it is animated

KisKeyFrameChannel already wraps the command into SkipFirstRedoWrapper,
so there is no need for another one.

This is a regression from 933c1fa041d97a23701e709eec8a9417f9a26fec

M  +3    -3    libs/image/kis_layer_utils.cpp

https://invent.kde.org/graphics/krita/-/commit/7eb718c2543ab120487e1916c6f8d01157ca02f3