windows.c: Fix broken subsurface_unset_conf()

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@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Lubomir I. Ivanov 2013-03-02 16:14:41 +02:00 committed by Dirk Hohndel
parent aa02798e2a
commit 3443abea72

View file

@ -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)