Bug 405119 - Flatten image with from a layers inside of a group results in all layers dissapearing.
Summary: Flatten image with from a layers inside of a group results in all layers diss...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (show other bugs)
Version: git master (please specify the git hash!)
Platform: Other Linux
: NOR critical
Target Milestone: ---
Assignee: Tiar
URL:
Keywords: regression, release_blocker
: 404200 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-03-05 20:21 UTC by wolthera
Modified: 2019-03-13 09:42 UTC (History)
4 users (show)

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


Attachments
Test .kra file (3.57 MB, application/zip)
2019-03-07 16:17 UTC, Tiar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wolthera 2019-03-05 20:21:21 UTC
SUMMARY
Flatten image, when used on a document with alpha inheritance used results in the deletion of all layers.


STEPS TO REPRODUCE
1. Get an image with multiple layers, with alpha inheritance used in it.
2. Layers->flatten image

OBSERVED RESULT
All the layers dissapear, and no node is visible in the layerstack.


EXPECTED RESULT
Just the flattened layers.

Might be caused by tyyppi's commit, but it could be anything? Noticed because my scripts broke with this.
Comment 1 Halla Rempt 2019-03-06 09:14:02 UTC
This happens if you have the layer with the alpha inheritance in a group, on top of another layer.

The bug started with 4.1.2; 4.1.1 still works fine.
Comment 2 Halla Rempt 2019-03-06 10:57:21 UTC
*** Bug 404200 has been marked as a duplicate of this bug. ***
Comment 3 Tiar 2019-03-07 16:17:48 UTC
Created attachment 118629 [details]
Test .kra file

Test:

1) Select Layer 9, Layer 8 and Layer 2.

2) Make sure the active layer is Layer 2.

3) Right-click on Layer 2, select "Merge with the layer below".

EXPECTED: one new layer in layer 10 that contains the merged results of the content of Layer 8 group and Layer 9. Layer 9 and Layer 8 are deleted.

ACTUAL: no layers inside the group Layer 10 (data loss).

This looks like a different issue but actually is caused by the same issue in the code.

This file is based on the file attached to the bug 404200.
Comment 4 Tiar 2019-03-11 18:17:45 UTC
Git commit 27947095edb13f17e88e6db3add682ee33345b0b by Agata Cacko.
Committed on 11/03/2019 at 18:17.
Pushed by tymond into branch 'master'.

Fix data loss after flattening the image from inside the group

Summary:
Before this patch, if the selected layer was inside of a group
and user requested flattening of the image, all layers
were deleted and no new layer with merged content appeared.
This commit makes the new layer with the merged content
be created and added to the layers stack.

Test Plan:
- testing with test file from BUG:404200 both from inside
of the group (Layer 2) and outside of the group (Layer 1)
- running unit tests added to the project in the patch
- merging and unmerging layers in a complex file

Reviewers: #krita, rempt

Reviewed By: #krita, rempt

Subscribers: rempt

Tags: #krita

Differential Revision: https://phabricator.kde.org/D19593

M  +37   -6    libs/image/kis_layer_utils.cpp
M  +34   -0    libs/image/tests/kis_image_test.cpp

https://commits.kde.org/krita/27947095edb13f17e88e6db3add682ee33345b0b
Comment 5 Tiar 2019-03-13 09:42:09 UTC
Since the problem was caused by a slightly different thing that the previous title suggested, I changed the title so future readers don't get confused.

Problem happened iff the selected layer while flattening was taking place was inside of a group. As far as I know, nothing was caused specifically by alpha inheritance. If the issue persists in some cases regarding the alpha inheritance, please reopen this bug and provide more information.