Bug 478519 - Inconsistent undo when converting global selection mask to transparency
Summary: Inconsistent undo when converting global selection mask to transparency
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (other bugs)
Version First Reported In: 5.2.2
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-14 19:13 UTC by paleh
Modified: 2024-01-11 10:22 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description paleh 2023-12-14 19:13:45 UTC
STEPS TO REPRODUCE
0. "Show global selection mask" must be active.
1. Create a selection.
2. Right click on the global selection mask in the layers docker and choose "Convert to transparency mask".
3. Press Undo twice (to get to before step 1).
4. Press Redo twice.

OBSERVED RESULT
After step 2, the selection mask doesn't exist. After step 4, it does.

EXPECTED RESULT
The state of the layers after step 2 is identical to that after state 4.

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

ADDITIONAL INFORMATION
I didn't find a way to create any actually serious problems which would be caused by this behavior, it's just inconsistent.
This was present in 5.1.5 and is present on master (git-1fc417ae3e)
Comment 1 Freya Lupen 2023-12-14 23:46:42 UTC
Confirmed. Some safe asserts are logged during this:
> SAFE ASSERT (krita): "!m_d->parent || !parent" in file /libs/image/kis_paint_device.cc, line 1195
> SAFE ASSERT (krita): "allowAsChild(newNode)" in file /libs/image/kis_node.cpp, line 472
This might have the same cause as bug 478520.
Comment 2 Dmitry Kazakov 2024-01-11 10:20:41 UTC
*** Bug 478520 has been marked as a duplicate of this bug. ***
Comment 3 Dmitry Kazakov 2024-01-11 10:22:19 UTC
Git commit 45491cdab843c617e35983534fafbf81ad900f0a by Dmitry Kazakov.
Committed on 11/01/2024 at 11:22.
Pushed by dkazakov into branch 'master'.

Fix inconsistent undo/redo of select/deselect/reselect actions

Before the patch, the global selection actions operated with a
raw selection object, not with a selection mask. It caused issues,
when the user manually converted/moved the global selection mask
into another position.

The patch changes this behavior and makes the selection commands
operate with the entire selection mask, which makes operations
consistent.
Related: bug 478520

M  +1    -1    krita/kritamenu.action
M  +2    -0    libs/image/CMakeLists.txt
A  +24   -0    libs/image/KisImageGlobalSelectionManagementInterface.h     [License: GPL(v2.0+)]
A  +39   -0    libs/image/commands/KisChangeDeselectedMaskCommand.cpp     [License: GPL(v2.0+)]
A  +31   -0    libs/image/commands/KisChangeDeselectedMaskCommand.h     [License: GPL(v2.0+)]
A  +21   -0    libs/image/commands/KisNotifySelectionChangedCommand.cpp     [License: GPL(v2.0+)]
A  +24   -0    libs/image/commands/KisNotifySelectionChangedCommand.h     [License: GPL(v2.0+)]
M  +18   -18   libs/image/commands/kis_deselect_global_selection_command.cpp
M  +3    -6    libs/image/commands/kis_deselect_global_selection_command.h
M  +25   -25   libs/image/commands/kis_reselect_global_selection_command.cpp
M  +3    -6    libs/image/commands/kis_reselect_global_selection_command.h
M  +36   -11   libs/image/commands/kis_set_global_selection_command.cpp
M  +3    -3    libs/image/commands/kis_set_global_selection_command.h
M  +22   -44   libs/image/kis_image.cc
M  +7    -26   libs/image/kis_image.h
M  +11   -7    libs/image/tests/kis_image_test.cpp
M  +4    -2    libs/libkis/Document.cpp
M  +1    -0    libs/ui/kis_action.h
M  +4    -0    libs/ui/kis_action_manager.cpp
M  +30   -9    libs/ui/kis_selection_manager.cc
M  +1    -0    libs/ui/kis_selection_manager.h

https://invent.kde.org/graphics/krita/-/commit/45491cdab843c617e35983534fafbf81ad900f0a