Bug 458556

Summary: Single layer PSD saved by Krita cannot be read by Krita
Product: [Applications] krita Reporter: Freya Lupen <penguinflyer2222>
Component: File formatsAssignee: amyspark <amy>
Status: RESOLVED FIXED    
Severity: normal CC: amy
Priority: NOR    
Version: 5.1.0   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Freya Lupen 2022-08-31 14:53:38 UTC
Issue:
Single layer PSD saved by Krita 5.1.0 cannot be read by Krita 5.1.0.

Steps:
1. Save a single, nontransparent layer as a .PSD file.
Krita will try to read the file after exporting it, and fail, also logging a safe assert.

> failed reading layer/mask section:  ""
> SAFE ASSERT (krita): "QThread::currentThread() == this->thread()" in file C:/Packaging/workspace/Krita_Release_Windows64_Build/krita/libs/widgetutils/KoProgressUpdater.cpp, line 165

2. Trying to open the file will show a dialog saying it cannot be opened. The same file can be opened in 5.0.6.

Expected:
1. The file can be opened in 5.1.0.

Notes:
Reverting lines 222-223 of libs/psd/psd_layer_section.cpp from
        dbgFile << "No layer info, so no PSD layers available";
        return false;
to:
        dbgFile << "No layer + mask info, so no layers, only a background layer";
        return true;
allows the file to load.
Those lines were changed in this commit: https://invent.kde.org/graphics/krita/-/commit/2dc3df63a8ad52468afd2a8a8f1123d4c080627d .
(Reverting them is not necessarily the correct solution.)
Comment 1 amyspark 2022-08-31 17:10:50 UTC
It is in fact the correct solution. I did that change because I'd thought a missing layer/mask info section was an error, but this is not the case for native PSD files.
Comment 2 amyspark 2022-08-31 17:11:10 UTC
Git commit 74f6bdafe7fb48063504811c68c2f63cf194856a by L. E. Segovia.
Committed on 31/08/2022 at 17:07.
Pushed by lsegovia into branch 'master'.

psd: fix opening single-layer files

The changes I'd intended for TIFF are correct, but they are not for
native PSD files.

M  +1    -1    libs/psd/psd_layer_section.cpp

https://invent.kde.org/graphics/krita/commit/74f6bdafe7fb48063504811c68c2f63cf194856a
Comment 3 amyspark 2022-08-31 17:11:39 UTC
Git commit 43f0ae30629817ee7cac70dc6972d850436b8f35 by L. E. Segovia.
Committed on 31/08/2022 at 17:11.
Pushed by lsegovia into branch 'krita/5.1'.

psd: fix opening single-layer files

The changes I'd intended for TIFF are correct, but they are not for
native PSD files.
(cherry picked from commit 74f6bdafe7fb48063504811c68c2f63cf194856a)

M  +1    -1    libs/psd/psd_layer_section.cpp

https://invent.kde.org/graphics/krita/commit/43f0ae30629817ee7cac70dc6972d850436b8f35