This is actually a bad bug which I had not realized at all until someone mentioned it to me anecdotally recently.
Some of our users have Kleopatra in autostart, and usually keep it running in the systray while their windows session is up.
At one point they had selected "only revoked certificates" as the keyfilter. And then without realizing it actually quit Kleopatra through File -> Quit.
But usually Kleopatra keeps running through the session, and when the user loggs out at the end of the day it seems to be killed in a way which does not trigger the dtor of KleopatraApplication which is the only place where KSharedConfig::openConfig()->sync() is called.
I believe that this is quite an important issue and that we should fix that in the Gpg4win/23.7 branch, too. Because a lot of our "usability" depends on things like reusing the last selected state for certifications or the last used signing key or last used encryption key etc. and I believe that users are just used to Kleopatra not remembering these things that this issue is not reported far more often.
First I will check if on Windows QCoreApplication::aboutToQuit() is signalled when the user logs out. Then this would obviously be a better place. I am sure that Windows Applications receive some kind of notification when the session is ended and Qt will likely pass that.
But we should sync more explicitly at more places. I somehow naively assumed that if you modify a KSharedConfig::openConfig object it would be synced automatically when it goes out of context.