subsurface/desktop-widgets/preferences
Berthold Stoeger 4fb01dd766 Fix ownership issues in preferences code
Each preferences object owns its string members. In three cases, pointers
were copied instead of strings, leading to (in the best case) dangling
pointers if the user edited values:
1) In the GET_TXT macro in core/prefs-macros.h
2) In the PreferencesDialog::defaultsRequested() method
3) In main() of the mobile version

This patch fixes these issues, by using copy_string() or copy_prefs()
as appropriate.

The only reason that the old code didn't crash regularly is that the
default_prefs object was only used at startup and defaultsRequested()
is (at the moment?) dead code.

This patch also aligns the backslashes in core/pref.h and fixes a typo.
The declaration of copy_prefs() is moved to the core/prefs.h header.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-25 07:41:09 -08:00
..
abstractpreferenceswidget.cpp
abstractpreferenceswidget.h
CMakeLists.txt
preferences_defaults.cpp
preferences_defaults.h
preferences_defaults.ui
preferences_georeference.cpp
preferences_georeference.h
preferences_graph.cpp
preferences_graph.h
preferences_graph.ui
preferences_language.cpp
preferences_language.h
preferences_network.cpp
preferences_network.h
preferences_network.ui
preferences_units.cpp
preferences_units.h
preferences_units.ui
preferencesdialog.cpp Fix ownership issues in preferences code 2017-11-25 07:41:09 -08:00
preferencesdialog.h
prefs_georeference.ui
prefs_language.ui