Fix settings not being persisted on exit #1453
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This patch fixes various not explicitly user-defined settings (e.g. opened databases, window geometry, entry view columns) etc. not being persisted reliably on application exit.
Motivation and context
Persistence of non-user-defined settings relied on destructors of various QObjects/QWidgets being called after exiting the main event loop and closing the application. This is not guaranteed to happen and therefore many settings weren't synced to persistent storage. I changed the behavior to listen for
QCoreApplication::aboutToQuit()
instead, which is the officially recommended way of doing last-minute activities in Qt.Actual user settings were not affected, because those are explicitly synced when leaving the settings dialog.
In addition, I snuck in a small translation fix for properly handling plurals in KDF parameters.
How has this been tested?
Closing the application now reliably writes all settings.
Types of changes
Checklist:
-DWITH_ASAN=ON
. [REQUIRED]