mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Correctly copy preferences
When just assigning one structure to the other we copy the string pointers. If we then modify those strings in the copy, we happily free the strings of the original. And then resetting the preferences equally happily reused those strings, pointing to long since freed memory. I think what I did now is excessive for the current use case in that it copies a ton of strings that are unset in the default_prefs. But I figured this is a rarely used function and I might as well do it correctly. Also, once we implement multi user support with per user preferences we will be copying completely populated preferences around (at least that's my guess). Fixes #940 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c75ec7a04a
commit
9d8b0addf9
7 changed files with 31 additions and 6 deletions
|
@ -18,7 +18,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
QApplication *application = new QApplication(argc, argv);
|
||||
git_libgit2_init();
|
||||
prefs = default_prefs;
|
||||
copy_prefs(&default_prefs, &prefs);
|
||||
init_qt_late();
|
||||
|
||||
QCommandLineParser parser;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue