Bug 446702

Summary: Bundle disable and enable with one of its tags selected doesn't repopulate the resource chooser completely
Product: [Applications] krita Reporter: amyspark <amy>
Component: Resource ManagementAssignee: amyspark <amy>
Status: RESOLVED FIXED    
Severity: minor CC: halla
Priority: NOR    
Version First Reported In: 5.0.0-beta5   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Before disabling Quiralta's brush set
After disabling Quiralta's brush set
After enabling Quiralta's brush set again

Description amyspark 2021-12-08 23:40:36 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
***
Disabling and reenabling a bundle with one of its tags selected doesn't repopulate the resource chooser completely.


STEPS TO REPRODUCE
1. Select the Quiralta tag in the brush preset chooser.
2. Disable the Quiralta brush set.
3. Reenable the Quiralta brush set.

OBSERVED RESULT
The preset chooser is repopulated, but the combobox isn't correctly restored.

EXPECTED RESULT
The preset chooser is repopulated, and the combobox is correctly restored.

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:42:49 UTC
Created attachment 144366 [details]
Before disabling Quiralta's brush set
Comment 2 amyspark 2021-12-08 23:43:08 UTC
Created attachment 144367 [details]
After disabling Quiralta's brush set
Comment 3 amyspark 2021-12-08 23:43:32 UTC
Created attachment 144368 [details]
After enabling Quiralta's brush set again

Check the combobox.
Comment 4 amyspark 2021-12-09 21:47:41 UTC
This is caused by KisTagChooserWidget::tagChanged being invoked with a tag value of -1, because of the storage model removing the currently selected tag. The fix is to ensure that in such cases, the tag is instead reset to "All", which is also done when it is deleted by the user.

However, adding the index reset on that function triggers a big (5 sec?) hangup because of what seems is a loop or race condition between the initial signal and the re-signaling caused by the forced index reset.

Halla, perhaps you know other way around it?
Comment 5 Bug Janitor Service 2021-12-09 22:17:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1215
Comment 6 amyspark 2021-12-13 19:59:47 UTC
Git commit 0535bdd3649700c1c7e9bcb4787c068fcd896807 by L. E. Segovia.
Committed on 13/12/2021 at 19:57.
Pushed by lsegovia into branch 'master'.

Ensure the tag is also reset on model reset

M  +2    -0    libs/resourcewidgets/KisTagChooserWidget.cpp

https://invent.kde.org/graphics/krita/commit/0535bdd3649700c1c7e9bcb4787c068fcd896807
Comment 7 amyspark 2021-12-13 20:00:57 UTC
Git commit 67e3f8d99afd05b42da6cced90f77cb18932ef23 by L. E. Segovia.
Committed on 13/12/2021 at 20:00.
Pushed by lsegovia into branch 'krita/5.0'.

Ensure the tag is also reset on model reset
(cherry picked from commit 0535bdd3649700c1c7e9bcb4787c068fcd896807)

M  +2    -0    libs/resourcewidgets/KisTagChooserWidget.cpp

https://invent.kde.org/graphics/krita/commit/67e3f8d99afd05b42da6cced90f77cb18932ef23