diff options
-rw-r--r-- | e-util/ChangeLog | 6 | ||||
-rw-r--r-- | e-util/e-config-listener.c | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 8fa6a15d03..7d6e154201 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,9 @@ +2002-11-13 Ettore Perazzoli <ettore@ximian.com> + + * e-config-listener.c (e_config_listener_get_string_with_default): + Make sure we don't use a string value from a GConfValue that got + freed. + 2002-11-12 Chris Toshok <toshok@ximian.com> * Makefile.am diff --git a/e-util/e-config-listener.c b/e-util/e-config-listener.c index 7f22cef8bb..ed57bf8cdc 100644 --- a/e-util/e-config-listener.c +++ b/e-util/e-config-listener.c @@ -412,7 +412,7 @@ e_config_listener_get_string_with_default (EConfigListener *cl, gboolean *used_default) { GConfValue *conf_value; - const char *str; + char *str; KeyData *kd; gpointer orig_key, orig_value; @@ -424,14 +424,14 @@ e_config_listener_get_string_with_default (EConfigListener *cl, /* not found, so retrieve it from the configuration database */ conf_value = gconf_client_get (cl->priv->db, key, NULL); if (conf_value) { - str = gconf_value_get_string (conf_value); + str = g_strdup (gconf_value_get_string (conf_value)); kd = add_key (cl, key, GCONF_VALUE_STRING, (gpointer) str, FALSE); gconf_value_free (conf_value); if (used_default != NULL) *used_default = FALSE; } else { - str = def; + str = g_strdup (def); kd = add_key (cl, key, GCONF_VALUE_STRING, (gpointer) str, TRUE); if (used_default != NULL) @@ -442,14 +442,14 @@ e_config_listener_get_string_with_default (EConfigListener *cl, g_assert (kd != NULL); if (kd->type == GCONF_VALUE_STRING) { - str = kd->value.v_str; + str = g_strdup (kd->value.v_str); if (used_default != NULL) *used_default = kd->used_default; } else return NULL; } - return g_strdup (str); + return str; } void |