From 1171f13e9e84aacb85b427f61dd03de35ed45751 Mon Sep 17 00:00:00 2001 From: Lauris Kaplinski Date: Tue, 19 Mar 2002 19:15:49 +0000 Subject: [PATCH] Fix few segfaults on broken schemas - but there are more --- capplets/keyboard/ChangeLog | 5 +++++ capplets/keyboard/gnome-keyboard-properties.c | 8 +++++--- control-center/ChangeLog | 4 ++++ control-center/capplet-dir.c | 7 +++---- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/capplets/keyboard/ChangeLog b/capplets/keyboard/ChangeLog index c023d23cb..30f88eeed 100644 --- a/capplets/keyboard/ChangeLog +++ b/capplets/keyboard/ChangeLog @@ -1,3 +1,8 @@ +2002-03-19 Lauris Kaplinski + + * gnome-keyboard-properties.c (bell_to_widget): Check that + value actually is string - that fixes crash with broken schemas + 2002-03-10 Seth Nickell * gnome-keyboard-properties.c: (main): diff --git a/capplets/keyboard/gnome-keyboard-properties.c b/capplets/keyboard/gnome-keyboard-properties.c index 1b595f08f..90f09e218 100644 --- a/capplets/keyboard/gnome-keyboard-properties.c +++ b/capplets/keyboard/gnome-keyboard-properties.c @@ -150,9 +150,11 @@ bell_to_widget (GConfValue *value) gint val = 2; new_value = gconf_value_new (GCONF_VALUE_INT); - gconf_string_to_enum (bell_enums, - gconf_value_get_string (value), - &val); + if (value->type == GCONF_VALUE_STRING) { + gconf_string_to_enum (bell_enums, + gconf_value_get_string (value), + &val); + } gconf_value_set_int (new_value, val); return new_value; diff --git a/control-center/ChangeLog b/control-center/ChangeLog index f246b6673..c51f0a973 100644 --- a/control-center/ChangeLog +++ b/control-center/ChangeLog @@ -1,3 +1,7 @@ +2002-03-19 Lauris Kaplinski + + * capplet-dir.c (find_icon): Do not do nasty things with NULL + 2002-03-12 Richard Hestilow * capplet-dir-view.h: Move CappletDirViewLayout enum here, diff --git a/control-center/capplet-dir.c b/control-center/capplet-dir.c index d1bf372bd..0a29e7144 100644 --- a/control-center/capplet-dir.c +++ b/control-center/capplet-dir.c @@ -57,11 +57,10 @@ GHashTable *capplet_hash = NULL; static char * find_icon (const char *icon, GnomeDesktopItem *dentry) { - char *icon_file = strdup (icon); + char *icon_file = NULL; - if (icon_file[0] == 0) { - g_free(icon_file); - icon_file = NULL; + if (icon && icon[0]) { + icon_file = g_strdup (icon); } if (icon_file) {