Bug 448118 - PSD: KisAslLayerStyleSerializer puts null pointers in the pattern store
Summary: PSD: KisAslLayerStyleSerializer puts null pointers in the pattern store
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: File formats (show other bugs)
Version: git master (please specify the git hash!)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Halla Rempt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-08 15:01 UTC by Halla Rempt
Modified: 2022-08-09 11:03 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Halla Rempt 2022-01-08 15:01:22 UTC
If the pattern referenced in a layer style in a psd file isn't found, the pattern store will contain an empty pattern:

krita.general: WARNING: ASL style contains non-existent pattern reference! Searching for uuid:  "bf565312-67b6-1177-9181-9d5762aa7056"  (name:  "$$$/Patterns/Defaults/RightDiagonalLine1=Right Diagonal Line 1" )
krita.lib.resources: No MD5 for 0x55e04bb09890 "invalid"
krita.general: convertAndSetBlendMode: Curve conversion is not implemented yet
krita.general: convertAndSetBlendMode: Curve conversion is not implemented yet
krita.general: convertAndSetBlendMode: Curve conversion is not implemented yet
QHash(("bf565312-67b6-1177-9181-9d5762aa7056_invalid", QSharedPointer(0x55e04bb09890))("bf565312-67b6-1177-9181-9d5762aa7056", QSharedPointer(0x0)))
Invalid or empty pattern QSharedPointer(0x0)
krita.general: convertAndSetBlendMode: Curve conversion is not implemented yet
krita.general: convertAndSetBlendMode: Curve conversion is not implemented yet
krita.general: WARNING: ASL style contains non-existent pattern reference! Searching for uuid:  "bf565312-67b6-1177-9181-9d5762aa7056"  (name:  "$$$/Patterns/Defaults/RightDiagonalLine1=Right Diagonal Line 1" )
krita.lib.resources: No MD5 for 0x55e04606f4a0 "invalid"
krita.general: convertAndSetBlendMode: Curve conversion is not implemented yet
krita.general: convertAndSetBlendMode: Curve conversion is not implemented yet
krita.general: convertAndSetBlendMode: Curve conversion is not implemented yet
QHash(("bf565312-67b6-1177-9181-9d5762aa7056_invalid", QSharedPointer(0x55e04606f4a0))("bf565312-67b6-1177-9181-9d5762aa7056", QSharedPointer(0x0)))
Invalid or empty pattern QSharedPointer(0x0)

The psd decode code assumes that all patterns in the store are valid and no nullptr. It's easy enough to check for that in the psd importer, but we shouldn't put 0x0 in the pattern store...
Comment 1 Halla Rempt 2022-01-08 15:03:16 UTC
Git commit ef700fa678a78f92020df888e949331ce18d782f by Halla Rempt.
Committed on 08/01/2022 at 15:03.
Pushed by rempt into branch 'master'.

Check whether the resource is valid/exists before adding to the storage

M  +12   -2    plugins/impex/psd/psd_loader.cpp

https://invent.kde.org/graphics/krita/commit/ef700fa678a78f92020df888e949331ce18d782f
Comment 2 Bug Janitor Service 2022-01-08 15:25:03 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1289
Comment 3 Halla Rempt 2022-01-20 13:54:08 UTC
Git commit 9c122000c4ad9c2d6c9bf6f8f6ba14d03f0eae46 by Halla Rempt.
Committed on 20/01/2022 at 13:53.
Pushed by rempt into branch 'master'.

Check whether loading the pattern worked

And don't nullpointers to the pattern cache

M  +8    -1    libs/image/kis_asl_layer_style_serializer.cpp
M  +6    -3    libs/psdutils/asl/kis_asl_xml_parser.cpp

https://invent.kde.org/graphics/krita/commit/9c122000c4ad9c2d6c9bf6f8f6ba14d03f0eae46
Comment 4 Halla Rempt 2022-01-20 13:56:52 UTC
Git commit 0c0d67f0631252062bf9457fc47bfa3fdc2d7c76 by Halla Rempt.
Committed on 20/01/2022 at 13:56.
Pushed by rempt into branch 'krita/5.0'.

Check whether loading the pattern worked

And don't nullpointers to the pattern cache
(cherry picked from commit 9c122000c4ad9c2d6c9bf6f8f6ba14d03f0eae46)

M  +8    -1    libs/image/kis_asl_layer_style_serializer.cpp
M  +6    -3    libs/psd/asl/kis_asl_xml_parser.cpp

https://invent.kde.org/graphics/krita/commit/0c0d67f0631252062bf9457fc47bfa3fdc2d7c76