Bug 480601

Summary: Crash when continuous selecting by color label reference includes a transform mask
Product: [Applications] krita Reporter: rhodenspire
Component: Tools/SelectionAssignee: Tiar <tamtamy.tymona>
Status: RESOLVED FIXED    
Severity: crash CC: halla, tamtamy.tymona
Priority: NOR    
Version: 5.2.2   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Crash Back Trace

Description rhodenspire 2024-01-31 14:47:47 UTC
Created attachment 165396 [details]
Crash Back Trace

SUMMARY
When using the continuous select tool in color tag mode, if one of the layers that happens to have the color you're selecting is a transform mask Krita crashes.

STEPS TO REPRODUCE
1. Add a transform mask to any layer
2. Assign a color to the layer (or assign it to the layer the transform mask was added to and it'll automatically inherit it)
3. Select continuous select tool in color label reference mode
4. If the transform mask's color matches one of the reference colors you've included, it crashes

OBSERVED RESULT
Krita crashes immediately after trying to make a selection

EXPECTED RESULT
I thought Krita would ignore the transform mask, it ignores it when you try to use continuous selection on the transform mask itself, but through color reference I guess it has an unexpected avenue.

SOFTWARE/OS VERSIONS
Windows: 11 22H2
Qt Version: 5.15.7

ADDITIONAL INFORMATION
I only came across this by chance while working on a large piece at home
Comment 1 Halla Rempt 2024-02-07 09:48:11 UTC
Thank you for the report. I can confirm the issue both with the 5.2.2 appimage and a build from master:

krita(38255)/(krita.general) T: [
        0: /home/halla/dev/i-krita//lib/x86_64-linux-gnu/libkritaglobal.so.20(kisBacktrace()+0x48) [0x7fc1fa1de408]
        1: /home/halla/dev/i-krita//lib/x86_64-linux-gnu/libkritaimage.so.20(KisMergeLabeledLayersCommand::collectNodes(KisSharedPtr<KisNode>, QList<KisSharedPtr<KisNode> >&, QList<KisMergeLabeledLayersCommand::ReferenceNodeInfo>&) const+0x99c) [0x7fc1f8ce949c]
        2: /home/halla/dev/i-krita//lib/x86_64-linux-gnu/libkritaimage.so.20(KisMergeLabeledLayersCommand::collectNodes(KisSharedPtr<KisNode>, QList<KisSharedPtr<KisNode> >&, QList<KisMergeLabeledLayersCommand::ReferenceNodeInfo>&) const+0x2b8) [0x7fc1f8ce8db8]
        3: /home/halla/dev/i-krita//lib/x86_64-linux-gnu/libkritaimage.so.20(KisMergeLabeledLayersCommand::collectNodes(KisSharedPtr<KisNode>, QList<KisSharedPtr<KisNode> >&, QList<KisMergeLabeledLayersCommand::ReferenceNodeInfo>&) const+0x2b8) [0x7fc1f8ce8db8]
        4: /home/halla/dev/i-krita//lib/x86_64-linux-gnu/libkritaimage.so.20(KisMergeLabeledLayersCommand::mergeLabeledLayers()+0x71) [0x7fc1f8ce9a81]
        5: /home/halla/dev/i-krita//lib/x86_64-linux-gnu/libkritaimage.so.20(KisMergeLabeledLayersCommand::redo()+0x14) [0x7fc1f8cec024]
        6: /home/halla/dev/i-krita//lib/x86_64-linux-gnu/libkritaimage.so.20(KisStrokeStrategyUndoCommandBased::doStrokeCallback(KisStrokeJobData*)+0x7e) [0x7fc1f8e367de]
        7: /home/halla/dev/i-krita//lib/x86_64-linux-gnu/libkritaimage.so.20(+0x212010) [0x7fc1f8c12010]
        8: /home/halla/dev/deps/lib/libQt5Core.so.5(+0xd14d2) [0x7fc1f74d14d2]
        9: /home/halla/dev/deps/lib/libQt5Core.so.5(+0xce223) [0x7fc1f74ce223]
        10: /lib/x86_64-linux-gnu/libc.so.6(+0x94ac3) [0x7fc1f6c94ac3]
        11: /lib/x86_64-linux-gnu/libc.so.6(+0x126660) [0x7fc1f6d26660]
]
Comment 2 Deif Lou 2024-03-20 15:35:44 UTC
Git commit 1a2dd9786eb4622bf596b0593b7a4a1ee9e21935 by Deif Lou.
Committed on 20/03/2024 at 15:34.
Pushed by deiflou into branch 'master'.

Fix crash on KisMergeLabeledLayersCommand when using color labeled transform masks

Now the masks are ignored when constructing the merged reference device

M  +53   -48   libs/image/commands_new/KisMergeLabeledLayersCommand.cpp

https://invent.kde.org/graphics/krita/-/commit/1a2dd9786eb4622bf596b0593b7a4a1ee9e21935
Comment 3 Deif Lou 2024-03-20 16:52:25 UTC
Git commit 185d3bbd616cc3352e41f4d83ba04a4f5e4bd1b1 by Deif Lou.
Committed on 20/03/2024 at 16:52.
Pushed by deiflou into branch 'krita/5.2'.

Fix crash on KisMergeLabeledLayersCommand when using color labeled transform masks

Now the masks are ignored when constructing the merged reference device


(cherry picked from commit 1a2dd9786eb4622bf596b0593b7a4a1ee9e21935)

M  +53   -48   libs/image/commands_new/KisMergeLabeledLayersCommand.cpp

https://invent.kde.org/graphics/krita/-/commit/185d3bbd616cc3352e41f4d83ba04a4f5e4bd1b1