Bug 459512 - Opening a psd file which has fill layer will make krita unresponsive or crash. Having the psd in recent document will make krita to hang on startup
Summary: Opening a psd file which has fill layer will make krita unresponsive or crash...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: File formats (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: triaged
: 458561 459971 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-09-22 07:34 UTC by Raghavendra kamath
Modified: 2022-10-05 07:42 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Raghavendra kamath 2022-09-22 07:34:42 UTC
SUMMARY
If a psd file contains fill layer either saved from photoshop or from krita itself. krita crashes or hangs when opening that file. if you reopen krita and if this file is in the recent document list, krita will hang or crash on startup. 


STEPS TO REPRODUCE
1. Create a new document.
2. Add a new fill layer with any colour 
3. Save the document as PSD and now close krita and open that PSD.

OBSERVED RESULT
Krita hangs or crashes.

EXPECTED RESULT
File should be opened normally

This happens on both windows and linux. This was first reported on krita-artists here - https://krita-artists.org/t/krita-5-1-1-crash-on-startup-reinstallation-does-not-work/48185/1
Comment 1 Halla Rempt 2022-09-22 08:10:53 UTC
I cannot reproduce a crash in current master or with the 5.1.1 appimage: the image from the original thread loads normally.
Comment 2 Halla Rempt 2022-09-22 08:15:45 UTC
Ah, no, I'm wrong. Krita can load the image fine, but the kimageformats framework which we use to load the thumbnails seems to crash.
Comment 3 Halla Rempt 2022-09-22 08:28:43 UTC
Okay, this is due to 

commit 48ca610ae89be95eb1db477379e54b37ab478ec2
Author: Dmitry Kazakov <dimula73@gmail.com>, Tue Jul 19 16:04:21 2022 +0300 (9 weeks ago)
Committer: Dmitry Kazakov <dimula73@gmail.com>, Tue Jul 19 16:04:41 2022 +0300 (9 weeks ago)
Follows: v5.2.0-prealpha
Branches: <Expand>

Use Krita's engine to load previews for PSD files

It makes loading of preview for the complex file from bug 444844
reduce from 300 sec to 40 sec.

BUG:456907

Because PSD files can contain references to resources, and the thumbnails are generated in a background thread, not the gui thread, and resources can only be accessed from the gui thread.
Comment 4 Halla Rempt 2022-09-22 08:35:49 UTC
Git commit 759751d3e6af9c493f62b9377c1dd8101ff15fe8 by Halla Rempt.
Committed on 22/09/2022 at 08:35.
Pushed by rempt into branch 'krita/5.1'.

Revert "Use Krita's engine to load previews for PSD files"

This reverts commit 48ca610ae89be95eb1db477379e54b37ab478ec2.

This made Krita try to access resources in a background thread,
which is not possible.
(cherry picked from commit 034a3c5c01b356b3c9b0f9f9bf84469d4e328c4d)

M  +1    -4    libs/ui/utils/KisFileIconCreator.cpp

https://invent.kde.org/graphics/krita/commit/759751d3e6af9c493f62b9377c1dd8101ff15fe8
Comment 5 Halla Rempt 2022-09-22 08:39:22 UTC
Backtrace: 

(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff52a9859 in __GI_abort () at abort.c:79
#2  0x00007ffff57590ab in QMessageLogger::fatal(char const*, ...) const ()
   from /home/halla/dev/deps/lib/libQt5Core.so.5
#3  0x00007ffff696a184 in kis_assert_common (assertion=0x7fffc0baed98 "\260\210\v\264\377\177", 
    file=0x7fffc0baeda0 "\002", line=24, throwException=<optimized out>, isIgnorable=<optimized out>)
    at /home/halla/dev/5.1/libs/global/kis_assert.cpp:89
#4  0x00007ffff69703a5 in kis_safe_assert_recoverable (
    assertion=assertion@entry=0x7ffff6b122e0 "QThread::currentThread() == (static_cast<QApplication *>(QCoreApplication::instance()))->thread()", 
    file=file@entry=0x7ffff6b12298 "/home/halla/dev/5.1/libs/resources/KisRequiredResourcesOperators.cpp", 
    line=line@entry=24) at /home/halla/dev/5.1/libs/global/kis_assert.cpp:107
#5  0x00007ffff6af7a81 in KisRequiredResourcesOperators::detail::assertInGuiThread ()
    at /home/halla/dev/5.1/libs/resources/KisRequiredResourcesOperators.cpp:24
#6  0x00007ffff6e2a023 in KisRequiredResourcesOperators::createLocalResourcesSnapshot<KisFilterConfiguration> (
    object=0x7fffb400f3c0, globalResourcesInterface=...)
    at /home/halla/dev/5.1/libs/resources/KisRequiredResourcesOperators.h:53
#7  0x00007ffff6e29801 in KisFilterConfiguration::createLocalResourcesSnapshot (this=<optimized out>, 
    globalResourcesInterface=...) at /home/halla/dev/5.1/libs/image/filter/kis_filter_configuration.cc:160
#8  0x00007fffc03966a1 in PSDLoader::decode (this=<optimized out>, io=...)
    at /home/halla/dev/5.1/plugins/impex/psd/psd_loader.cpp:338
#9  0x00007fffc0398962 in PSDLoader::buildImage (this=this@entry=0x7fffc0baf4a0, io=...)
    at /home/halla/dev/5.1/plugins/impex/psd/psd_loader.cpp:432
#10 0x00007fffc03928b9 in psdImport::convert (this=<optimized out>, document=0x7fffb40025e0, io=0x7fffc0baf510)
    at /home/halla/dev/5.1/plugins/impex/psd/psd_import.cc:29
#11 0x00007ffff7c4c45c in KisImportExportManager::doImport (this=0x7fffb4005e80, location=..., filter=...)
    at /home/halla/dev/5.1/libs/ui/KisImportExportManager.cpp:668
#12 0x00007ffff7c4dcaa in KisImportExportManager::convert (this=0x7fffb4005e80, direction=<optimized out>, 
    location=..., realLocation=..., mimeType=..., showWarnings=<optimized out>, exportConfiguration=..., 
    isAsync=<optimized out>, isAdvancedExporting=<optimized out>)
    at /home/halla/dev/5.1/libs/ui/KisImportExportManager.cpp:379
#13 0x00007ffff7c4ea8b in KisImportExportManager::importDocument (this=this@entry=0x7fffb4005e80, location=..., 
    mimeType=...) at /home/halla/dev/5.1/libs/global/kis_shared_ptr.h:206
#14 0x00007ffff7c336c5 in KisDocument::openFile (this=0x7fffb40025e0)
    at /home/halla/dev/5.1/libs/ui/KisDocument.cpp:1870
#15 0x00007ffff7c34139 in KisDocument::openPathInternal (this=0x7fffb40025e0, path=...)
    at /home/halla/dev/5.1/libs/ui/KisDocument.cpp:2410
#16 0x00007ffff7c39779 in KisDocument::openPath (this=this@entry=0x7fffb40025e0, _path=..., flags=..., 
    flags@entry=...) at /home/halla/dev/5.1/libs/ui/KisDocument.cpp:1806
#17 0x00007ffff7b393d5 in KisFileIconCreator::createFileIcon (this=this@entry=0x7fffc0bafc98, path=..., 
    icon=..., devicePixelRatioF=devicePixelRatioF@entry=1, iconSize=...)
    at /home/halla/dev/deps/include/QtCore/qflags.h:120
#18 0x00007ffff7b3c6b2 in (anonymous namespace)::getFileIcon (gfip=...)
    at /home/halla/dev/5.1/libs/ui/utils/KisRecentFileIconCache.cpp:51
#19 0x00007ffff7b3b165 in QtConcurrent::StoredFunctorCall1<(anonymous namespace)::IconFetchResult, (anonymous namespace)::IconFetchResult (*)((anonymous namespace)::GetFileIconParameters), (anonymous namespace)::GetFileIconParameters>::runFunctor (this=0x5555596b5ef0)
    at /home/halla/dev/deps/include/QtConcurrent/qtconcurrentstoredfunctioncall.h:422
#20 QtConcurrent::RunFunctionTask<(anonymous namespace)::IconFetchResult>::run (this=0x5555596b5ef0)
    at /home/halla/dev/deps/include/QtConcurrent/qtconcurrentrunbase.h:108
#21 0x00007ffff57962c2 in ?? () from /home/halla/dev/deps/lib/libQt5Core.so.5
#22 0x00007ffff5792d27 in ?? () from /home/halla/dev/deps/lib/libQt5Core.so.5
#23 0x00007ffff4579609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#24 0x00007ffff53a6133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Comment 6 Halla Rempt 2022-09-22 14:28:06 UTC
*** Bug 458561 has been marked as a duplicate of this bug. ***
Comment 7 Halla Rempt 2022-09-23 10:51:44 UTC
Git commit d52cf1977648731ff67213fbaa88667829b214ec by Halla Rempt.
Committed on 23/09/2022 at 10:40.
Pushed by rempt into branch 'master'.

Revert "Use Krita's engine to load previews for PSD files"

This reverts commit 48ca610ae89be95eb1db477379e54b37ab478ec2.

This made Krita try to access resources in a background thread,
which is not possible.

M  +1    -4    libs/ui/utils/KisFileIconCreator.cpp

https://invent.kde.org/graphics/krita/commit/d52cf1977648731ff67213fbaa88667829b214ec
Comment 8 Alvin Wong 2022-10-05 07:42:07 UTC
*** Bug 459971 has been marked as a duplicate of this bug. ***