From 725e4582d9c7174b70fe197bb27345960457549e Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 2 May 2012 10:03:48 -0700 Subject: Don't close config file when changing preferences On Linux and MacOS the subsurface_close_conf() doesn't really close the config file (it flushes writes on MacOS), but on Windows it does actually close the registry hkey. Which is bad, if you change the settings multiple times - we assume that the config file is open the whole time. So add a "subsurface_flush_conf()" function, and call *that* when changing configuration parameters. And call the close function only at the very end. Alternatively, maybe we should just open the config file separately every time. I don't much care, maybe somebody else does. Signed-off-by: Linus Torvalds --- gtk-gui.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gtk-gui.c') diff --git a/gtk-gui.c b/gtk-gui.c index 7d0e95c43..6f48c734f 100644 --- a/gtk-gui.c +++ b/gtk-gui.c @@ -423,7 +423,9 @@ static void preferences_dialog(GtkWidget *w, gpointer data) subsurface_set_conf("SAC", PREF_BOOL, BOOL_TO_PTR(visible_cols.sac)); subsurface_set_conf("OTU", PREF_BOOL, BOOL_TO_PTR(visible_cols.otu)); subsurface_set_conf("divelist_font", PREF_STRING, divelist_font); - subsurface_close_conf(); + + /* Flush the changes out to the system */ + subsurface_flush_conf(); } gtk_widget_destroy(dialog); } @@ -769,6 +771,11 @@ void run_ui(void) gtk_main(); } +void exit_ui(void) +{ + subsurface_close_conf(); +} + typedef struct { cairo_rectangle_int_t rect; const char *text; -- cgit v1.2.3-70-g09d2