Bug 443074

Summary: Cannot use bundle-backed resources if versioned and the files have been deleted on disk
Product: [Applications] krita Reporter: amyspark <amy>
Component: Resource ManagementAssignee: amyspark <amy>
Status: RESOLVED FIXED    
Severity: normal CC: tamtamy.tymona
Priority: NOR    
Version First Reported In: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description amyspark 2021-09-28 14:16:15 UTC
SUMMARY

If the versioned file backing a modified resource is deleted, and this resource is originally part of a bundle, Krita no longer recognizes the resource.

STEPS TO REPRODUCE
1. Edit one of the predefined SeExpr scripts, e.g. Wolthera's Conical Gradient.
2. Overwrite the script.
3. Close Krita.
4. Delete the generated file, it should be in e.g. "Krita_Artists_SeExpr_examples.bundle_modified\seexpr_scripts\Wolthera's_Conical_Gradient.0001.kse"
5. Open Krita again and try to select Wolthera's Conical Gradient.

OBSERVED RESULT

Krita does not recognize the resources anymore. It is rendered in the resource chooser, but selecting it has no effect.

If a resource was stored as the default one (via preferences), selecting the broken resource will cause the default one to be rendered, but without updating the resource chooser.

EXPECTED RESULT

Krita should fall back to the resource version existing in the bundle and continue normally.

SOFTWARE/OS VERSIONS
Windows: 10 20H2 (19042.1237)
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 5.64.0
Qt Version: 5.12.11

ADDITIONAL INFORMATION

Git hash 016cca2132

This bug was tested with the upcoming MR for SeExpr scripts, but should be equally reproducible with e.g. brush presets, as the versioning is handled by the resource system.
Comment 1 Bug Janitor Service 2021-12-01 02:37:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1191
Comment 2 amyspark 2021-12-01 12:36:11 UTC
Git commit 7aa3a3d26cebdb314506c08a3830c717321b4553 by L. E. Segovia.
Committed on 01/12/2021 at 12:32.
Pushed by lsegovia into branch 'master'.

Fix version downgrade on removed storage

M  +6    -6    libs/resources/KisResourceCacheDb.cpp

https://invent.kde.org/graphics/krita/commit/7aa3a3d26cebdb314506c08a3830c717321b4553
Comment 3 amyspark 2021-12-01 12:39:13 UTC
Git commit 557fcaeb25e4884a10294341e42b7bc718d17f0f by L. E. Segovia.
Committed on 01/12/2021 at 12:37.
Pushed by lsegovia into branch 'krita/5.0'.

Fix version downgrade on removed storage
(cherry picked from commit 7aa3a3d26cebdb314506c08a3830c717321b4553)

M  +6    -6    libs/resources/KisResourceCacheDb.cpp

https://invent.kde.org/graphics/krita/commit/557fcaeb25e4884a10294341e42b7bc718d17f0f