Bug 430474

Summary: copy and paste a selection mask to another layer cause a display glitch on canvas view
Product: [Applications] krita Reporter: h0nm4m31k0 <cjjmpgjjl.113>
Component: Layer StackAssignee: Eoin O'Neill <eoinoneill1991>
Status: RESOLVED FIXED    
Severity: normal CC: ahab.greybeard, eoinoneill1991, halla, tomtomtomreportingin
Priority: NOR Keywords: regression
Version First Reported In: 4.4.1   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: even you select another layer the glitch still remain.
Selection Glitch with copied selection mask

Description h0nm4m31k0 2020-12-16 18:26:20 UTC
Created attachment 134124 [details]
even you select another layer the glitch still remain.

SUMMARY
When copy and paste a local selection mask to another layer then select the duplicate mask to edit, the view doesn't render the mask correctly, 

STEPS TO REPRODUCE
1. create a local selection mask
2. copy and paste it to another layer
3. active the new mask and select it 

OBSERVED RESULT
the "red zone" of non-selected area doesn't show up, use brush to edit will cause display glitch,but selection still work. Hide/Show an upper layer which the  contents cover the whole canva can resolve the glitch.(see attachment)

EXPECTED RESULT
The "red zone" of non-selected area render correctly.

SOFTWARE/OS VERSIONS
Windows: 10.0.19041
Qt Version: 5.12.9

ADDITIONAL INFORMATION
Comment 1 Ahab Greybeard 2020-12-17 09:46:47 UTC
Created attachment 134141 [details]
Selection Glitch with copied selection mask

I can confirm this for the 4.4.1 and the Dec 16 4.4.3 alpha (git 03ff1ba) appimages on Debian 10

See attached image 'Slection-Glitch' which has a simple square selection and a copy of that selection.

The glitch can not be removed by manipulating mask enable/disable or layer visibility.
It can be removed by deleting Paint Layer 4 or any other layer that is in the image but it returns if you select the original mask then the copy of the mask.

If you Save the image and reopen it, the glitch is gone and does not reappear from then on.

Setting to Confirmed
Comment 2 tomtomtomreportingin 2021-03-16 17:12:31 UTC
*** Bug 434318 has been marked as a duplicate of this bug. ***
Comment 3 tomtomtomreportingin 2021-03-16 17:13:19 UTC
As noted in the duplicate, this is introduced in 4.2.8, so marking it as a regression.
Comment 4 Eoin O'Neill 2021-05-04 05:17:52 UTC
Git commit 25688ad2ec85024c33c19bbff845f2427be0dc50 by Eoin O'Neill.
Committed on 04/05/2021 at 05:13.
Pushed by eoinoneill into branch 'master'.

Fixed edge case where KisSelectionMask would not update
after duplication; The canvas would get stuck w/ rendered
shaded selection mask overlay and not properly respond to
selection of other nodes.

M  +2    -2    libs/image/kis_layer.cc
M  +7    -4    libs/image/kis_selection_mask.cpp

https://invent.kde.org/graphics/krita/commit/25688ad2ec85024c33c19bbff845f2427be0dc50