Bug 342541

Summary: Krita forgets existing preset tags on every restart
Product: [Applications] krita Reporter: Tyson Tan <tysontanx>
Component: UsabilityAssignee: Halla Rempt <halla>
Status: RESOLVED FIXED    
Severity: normal CC: griffinvalley, halla, portnov
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Brush Preset docker doesn't display tags

Description Tyson Tan 2015-01-06 03:11:40 UTC
A few days before Krita 2.9 Beta 1 (git 4b84fad), Krita started to forget existing preset tags on every restart. 

After a restart, popup palette would still list the tags, and the tags seem to have all the presets assigned to them before. The problem is that Krita does not load anything onto the palette automatically, so everytime I started Krita I got a empty popup palette. 

After a restart, the "Tag" dropdown list becomes empty, same does the context menu. I cannot assign an existing tag to any tool without making a new one. However, after a new tag with the same old name is created, it actually has everything that I assigned to it before.

Reproducible: Always

Steps to Reproduce:
1. Create a document
2. Brush Preset docker > Context menu > Addign to a tag, say, "general"
3. Popup palette > Load the "general" presets.
4. Restart Krita

Actual Results:  
Popup palette becomes empty. Existing tags in Brush Preset docker are all emptied. Cannot assign any tag unless creating a new one.

Expected Results:  
Popup palette automatically loads the last-used preset. Brush preset docker does not forget existing tags every restart.
Comment 1 Halla Rempt 2015-01-06 07:36:02 UTC
Yes, I can confirm. Somehow the tag _is_ present, it's just now shown in the list. But I can select a test tag in the favourites after restarting krita, and it shows the right presets. I'm suspecting that the background loading of resources implemented in 880bb7627174158daf38fe1c3c89770cbba748cc is the culprit.
Comment 2 Tyson Tan 2015-01-06 12:44:43 UTC
@Boud. OK, thank you for looking into this! 

BTW, I was very sleepy while reporting this, and thus forgot to mention that the following text actually refered to what happened in Brush Preset docker.

"After a restart, the "Tag" dropdown list becomes empty, same does the context menu. I cannot assign an existing tag to any tool without making a new one. However, after creating a new tag with the same old name, it actually has everything that I assigned to it before. "
Comment 3 Halla Rempt 2015-01-08 15:19:13 UTC
Git commit 18478bb5d80bc9b0cfc8718709d11cca002efddd by Boudewijn Rempt.
Committed on 08/01/2015 at 14:25.
Pushed by rempt into branch 'calligra/2.9'.

Fix loading the favorite presets for the popup palette.

Only initialize the popup palette when we need the actual resources,
instead of in the constructor. In the constructor, the presets aren't
all loaded, so it's hit and miss which ones are in the popop.

M  +28   -20   krita/ui/kis_favorite_resource_manager.cpp
M  +6    -0    krita/ui/kis_favorite_resource_manager.h

http://commits.kde.org/calligra/18478bb5d80bc9b0cfc8718709d11cca002efddd
Comment 4 Tyson Tan 2015-01-08 15:44:45 UTC
Thank you! I can confirm the popup palette is automatically loading again. Now all we have left is the problem with Brush Preset docker.
Comment 5 Halla Rempt 2015-01-08 16:28:49 UTC
I'm working on that :-)
Comment 6 Halla Rempt 2015-01-10 15:54:18 UTC
Git commit 2cad556a5d1c6890cb06741b4196c751bffbabf9 by Boudewijn Rempt.
Committed on 10/01/2015 at 15:53.
Pushed by rempt into branch 'calligra/2.9'.

M  +4    -0    libs/widgets/KoResourceServer.h

http://commits.kde.org/calligra/2cad556a5d1c6890cb06741b4196c751bffbabf9
Comment 7 Tyson Tan 2015-01-11 01:37:43 UTC
It's all OK now, thank you! :)
Comment 8 Tyson Tan 2015-01-11 02:00:57 UTC
Sorry, the first time I started Krita the Brush Preset docker did seem to be fixed, however, under real-use circumstance I found the problem has not been fixed and with new problem appeared.

I don't know why, but the first time I started Krita after the last commit, the Brush Preset docker did display all tags. But after a restart the tags were gone. Krita always load the default Favorite Preset as the new ones I created cannot be detected. What's worse, even if I manually create a new tag with the same old name, and it still holds the tools I assigned to it before, but the Popup Palette just cannot load it, even when I did it manually.
Comment 9 wolthera 2015-01-12 09:16:20 UTC
I can confirm Tyson's observations.

The pop-up palette worked for me, it's now not even switching tags.
Comment 10 Halla Rempt 2015-01-12 15:16:32 UTC
Git commit 1b338fde5b5391c5be4e5329ea5a764fb6d77b31 by Boudewijn Rempt.
Committed on 12/01/2015 at 15:14.
Pushed by rempt into branch 'calligra/2.9'.

M  +2    -1    krita/ui/kis_favorite_resource_manager.cpp

http://commits.kde.org/calligra/1b338fde5b5391c5be4e5329ea5a764fb6d77b31
Comment 11 Tyson Tan 2015-01-13 01:42:26 UTC
Created attachment 90380 [details]
Brush Preset docker doesn't display tags

Thank you for fixing the Popup Palette loading issue. However, the Brush Preset docker problem is still there. The drop-down menu shows no tags after each restart. Neither does the right-click > assign to tag menu over the brushes.

I have to create the same tag again to get it displayed.
Comment 12 Tyson Tan 2015-01-13 12:36:34 UTC
There is a workaround I can use to make tags appear again without creating them again:
1. If Popup palette was loading tag A the last time I closed Krita;
2. Start Krita, manually load tag B onto the Popup palette;
3. Check Brush Preset dock's menu and I will see all my tags returned.
* Does not work if I checked Brush Preset before manually loading a tag.
Comment 13 Tyson Tan 2015-01-13 13:10:18 UTC
After a series of success, the trick I mentioned in Comment 12 failed to work. I was only able to make it work again by rebooting the system (or log out / log in).

After the reboot, I found Krita can actually display all tags this time, but only on the first session. With all tags being shown in the Brush Preset docker, if I load tag B onto the Popup Palette, it would actually disappear from the docker.

If Krita was loading tag B instead of the default Favorite Presets when I closed it, Brush Preset docker in the next session would display nothing unless I recreate a tag.

Maybe, it was actually triggered by changing what to be loaded to Popup Palette on the next launch?
Comment 14 Stefano Bonicatti 2015-01-13 23:31:18 UTC
Git commit 6fa0e0d14d1b31f317c29d10c75b4520bbf735aa by Stefano Bonicatti.
Committed on 13/01/2015 at 19:27.
Pushed by stefanobonicatti into branch 'calligra/2.9'.

Fix for new tags not loading after restart

It was missing a connection between KoResourceModel tagBoxEntryModified
event and KoTaggingResourceManager.

M  +11   -0    libs/widgets/KoResourceTaggingManager.cpp
M  +1    -0    libs/widgets/KoResourceTaggingManager.h

http://commits.kde.org/calligra/6fa0e0d14d1b31f317c29d10c75b4520bbf735aa
Comment 15 wolthera 2015-01-14 00:12:03 UTC
this works for me! :)
Comment 16 Tyson Tan 2015-01-14 14:38:21 UTC
Thank you for fixing the bug completely this time, Stefano! :)
Comment 17 Tyson Tan 2015-01-27 12:08:42 UTC
After a period of usage, I found that the popup palette would still occasionally fail to auto-load my last used tag and fall back to the default favorite tag. It doesn't happen everytime when I restart Krita, but it happens -- once in a few days. So far, I couldn't figure out what triggers the issue.