Bug 446705

Summary: Importing the same bundle with a different filename doesn't deduplicate resources
Product: [Applications] krita Reporter: amyspark <amy>
Component: Resource ManagementAssignee: amyspark <amy>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73
Priority: NOR    
Version: 5.0.0-beta5   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Bug Depends on: 445367    
Bug Blocks:    
Attachments: Screenshot of the bug

Description amyspark 2021-12-08 23:56:58 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***
Importing the very same .bundle file (only changing its filename) results in two identical copies of all affected resources.

STEPS TO REPRODUCE
1. Import the Quiralta brush set.
2. Rename the .bundle to e.g. "test.bundle".
3. Import the renamed bundle again.

OBSERVED RESULT
Bundle is imported, and results on two copies of its resources being active at the same time.

EXPECTED RESULT
Bundle is correctly detected as a duplicate and is skipped.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 amyspark 2021-12-08 23:57:45 UTC
Created attachment 144370 [details]
Screenshot of the bug
Comment 2 amyspark 2021-12-09 21:59:16 UTC
It's a byproduct of bug 445367. The model considers duplicates too narrowly. (cc Dmitry, I'll need your review on the fix)
Comment 3 Bug Janitor Service 2021-12-09 22:17:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1215
Comment 4 Bug Janitor Service 2021-12-13 13:46:53 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1225
Comment 5 Dmitry Kazakov 2021-12-13 13:49:06 UTC
Git commit e23a445df24079c5b23a4055341cc6c67e46f73b by Dmitry Kazakov.
Committed on 13/12/2021 at 13:48.
Pushed by dkazakov into branch 'master'.

Fix resource duplication when any tag is selected

It looks like we switch the model when a a tag is selected, so this
model should also perform the group-by-based deduplication.

M  +6    -3    libs/resources/KisTagResourceModel.cpp

https://invent.kde.org/graphics/krita/commit/e23a445df24079c5b23a4055341cc6c67e46f73b
Comment 6 Dmitry Kazakov 2021-12-13 13:49:31 UTC
Git commit 4d7b3c3f7c9cde04196183727c0e2d3c7cc77cca by Dmitry Kazakov.
Committed on 13/12/2021 at 13:49.
Pushed by dkazakov into branch 'krita/5.0'.

Fix resource duplication when any tag is selected

It looks like we switch the model when a a tag is selected, so this
model should also perform the group-by-based deduplication.
(cherry picked from commit e23a445df24079c5b23a4055341cc6c67e46f73b)

M  +6    -3    libs/resources/KisTagResourceModel.cpp

https://invent.kde.org/graphics/krita/commit/4d7b3c3f7c9cde04196183727c0e2d3c7cc77cca