[PATCH] windows.c: Fix broken subsurface_unset_conf()

Lubomir I. Ivanov neolit123 at gmail.com
Sat Mar 2 06:14:41 PST 2013


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

windows.c has be revisited so many times, yet just now I've noticed
that we aren't deleting/unsetting a configuration value ever.
What has went strangely unnoticed is that subsurface_unset_conf()
needs RegDeleteValue instead of RegDeleteKey. "keys" in the Windows
registry are like folders which contain files (or "values").
So in this case we need to delete a "file" and not a "folder" using
RegDeleteValue().

This ended up  being a problem with the new prefs.c logic, where there
is a check if a config value is the default value and then it will be
unset/deleted.

There was potential for a crash, where a NULL value can reach
pango_font_description_from_string() for the divelist font.
It also wasn't possible to change the divelist font back to the default font
(e.g. Sans 8), once a different font was selected.

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
 windows.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/windows.c b/windows.c
index 2eed741..b711480 100644
--- a/windows.c
+++ b/windows.c
@@ -22,7 +22,7 @@ void subsurface_open_conf(void)
 
 void subsurface_unset_conf(char *name)
 {
-	RegDeleteKey(hkey, (LPCTSTR)name);
+	RegDeleteValue(hkey, (LPCTSTR)name);
 }
 
 void subsurface_set_conf(char *name, const char *value)
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list