Today I fixed a showstopper for Krita 5 beta. As it turns out, our preferences backend, which is based around KisConfig and in turn KSharedConfig, uses QCoreApplication properties to instance the preferences file on disk before loading or saving. If any rogue code (like GMic) tampers with QCoreApplication's organizationName, organizationDomain and applicationName, parts of our code will start loading or saving preferences from different locations unpredictably.
This led me and @rempt to notice that we do not have a single source of truth for reading and storing preferences. In fact:
- 98 instances across 30 files call KisConfig either as read or as write.
- 100 instances across 45 files (including KisConfig itself) instance KSharedConfig::openConfig() directly. This involves almost every tool plugin.
We should refactor our preferences system, perhaps like our resource servers, to load and store at once from the GUI thread, and centralize data supply to the rest of Krita.