Bug 398814

Summary: lose previously selected layer on undo of flatten image
Product: [Applications] krita Reporter: wkg28406
Component: Layer StackAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: halla
Priority: NOR    
Version: 4.1.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description wkg28406 2018-09-18 18:32:24 UTC
Krita 4.1.1-4 (Arch Linux)

Tested with fresh configuration (removing existing ~/.local/share/krita, ~/.config/krita*)

Reproducible: Always

Steps:
1. Create new document (ctrl+n)
2. Layer > Flatten Image (ctrl+shift+e)
3. Undo (ctrl+z)

Results:
No layer selected, unable to perform action until manually select in layer docker.

Expected:
Previously selected layer, in this case Layer 2, selected and active.

Likely happens because new layer is created called "root Merged", thus when undone no longer has reference. This does not happen with normal merges (ctrl+e).
Comment 1 Dmitry Kazakov 2018-09-20 17:34:12 UTC
Git commit 8564a3a47e7813ca6ade09a680b19f1c1cddd4fa by Dmitry Kazakov.
Committed on 20/09/2018 at 17:08.
Pushed by dkazakov into branch 'master'.

Fix selecting of the layer after undoing Flatten Image

M  +2    -2    libs/image/kis_image.cc
M  +1    -1    libs/image/kis_image.h
M  +7    -2    libs/image/kis_layer_utils.cpp
M  +1    -1    libs/image/kis_layer_utils.h
M  +1    -1    libs/image/tests/kis_image_test.cpp
M  +1    -1    libs/libkis/Document.cpp
M  +1    -1    libs/ui/kis_layer_manager.cc
M  +1    -1    libs/ui/tests/kis_dummies_facade_base_test.cpp
M  +1    -1    libs/ui/tests/kis_node_model_test.cpp
M  +1    -1    plugins/extensions/separate_channels/kis_channel_separator.cc

https://commits.kde.org/krita/8564a3a47e7813ca6ade09a680b19f1c1cddd4fa
Comment 2 Halla Rempt 2018-09-24 07:25:11 UTC
Git commit 9e6e3edcbbaf7ac2c9d8ad1fa9a3c886e2be27f1 by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 24/09/2018 at 07:05.
Pushed by rempt into branch 'krita/4.1'.

Fix selecting of the layer after undoing Flatten Image

M  +2    -2    libs/image/kis_image.cc
M  +1    -1    libs/image/kis_image.h
M  +7    -2    libs/image/kis_layer_utils.cpp
M  +1    -1    libs/image/kis_layer_utils.h
M  +1    -1    libs/image/tests/kis_image_test.cpp
M  +1    -1    libs/libkis/Document.cpp
M  +1    -1    libs/ui/kis_layer_manager.cc
M  +1    -1    libs/ui/tests/kis_dummies_facade_base_test.cpp
M  +1    -1    libs/ui/tests/kis_node_model_test.cpp
M  +1    -1    plugins/extensions/separate_channels/kis_channel_separator.cc

https://commits.kde.org/krita/9e6e3edcbbaf7ac2c9d8ad1fa9a3c886e2be27f1