summaryrefslogtreecommitdiffstats
path: root/windows.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-05-02 10:03:48 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-05-02 10:03:48 -0700
commit725e4582d9c7174b70fe197bb27345960457549e (patch)
treeb51b3ebd8867e5577ef460602af2b880b4d5ec17 /windows.c
parent2d1a316d848441a7d1137cb51b1ee0b8222aaa74 (diff)
downloadsubsurface-725e4582d9c7174b70fe197bb27345960457549e.tar.gz
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 <torvalds@linux-foundation.org>
Diffstat (limited to 'windows.c')
-rw-r--r--windows.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/windows.c b/windows.c
index 46b6951bd..0353adef3 100644
--- a/windows.c
+++ b/windows.c
@@ -73,10 +73,15 @@ const void *subsurface_get_conf(char *name, pref_type_t type)
return NULL;
}
-void subsurface_close_conf(void)
+void subsurface_flush_conf(void)
{
+ /* I wonder if we should even do this - it's apparently very expensive */
if (RegFlushKey(hkey) != ERROR_SUCCESS)
printf("RegFlushKey failed \n");
+}
+
+void subsurface_close_conf(void)
+{
RegCloseKey(hkey);
}