don't free the GConf value if we don't have one. Fixes a crash when

2008-03-11  Jens Granseuer  <jensgr@gmx.net>

	* gconf-property-editor.c: (peditor_numeric_range_widget_changed): don't
	free the GConf value if we don't have one. Fixes a crash when schemas
	are not properly installed (bug #520744)

svn path=/trunk/; revision=8574
This commit is contained in:
Jens Granseuer 2008-03-11 17:33:31 +00:00 committed by Jens Granseuer
parent d7b2a5e962
commit d3b988bc36
2 changed files with 11 additions and 6 deletions

View file

@ -1,3 +1,9 @@
2008-03-11 Jens Granseuer <jensgr@gmx.net>
* gconf-property-editor.c: (peditor_numeric_range_widget_changed): don't
free the GConf value if we don't have one. Fixes a crash when schemas
are not properly installed (bug #520744)
2008-02-27 Jens Granseuer <jensgr@gmx.net> 2008-02-27 Jens Granseuer <jensgr@gmx.net>
* file-transfer-dialog.c: (file_transfer_dialog_update_num_files), * file-transfer-dialog.c: (file_transfer_dialog_update_num_files),

View file

@ -1122,7 +1122,7 @@ peditor_numeric_range_widget_changed (GConfPropertyEditor *peditor,
if (!peditor->p->inited) return; if (!peditor->p->inited) return;
/* We try to get the default type from the schemas. if not, we default /* We try to get the default type from the schemas. if not, we default
* to a float. * to an int.
*/ */
client = gconf_client_get_default(); client = gconf_client_get_default();
@ -1131,9 +1131,10 @@ peditor_numeric_range_widget_changed (GConfPropertyEditor *peditor,
NULL); NULL);
g_object_unref (client); g_object_unref (client);
if (default_value) if (default_value) {
value_wid = gconf_value_new (default_value->type); value_wid = gconf_value_new (default_value->type);
else { gconf_value_free (default_value);
} else {
g_warning ("Unable to find a default value for key for %s.\n" g_warning ("Unable to find a default value for key for %s.\n"
"I'll assume it is an integer, but that may break things.\n" "I'll assume it is an integer, but that may break things.\n"
"Please be sure that the associated schema is installed", "Please be sure that the associated schema is installed",
@ -1141,8 +1142,6 @@ peditor_numeric_range_widget_changed (GConfPropertyEditor *peditor,
value_wid = gconf_value_new (GCONF_VALUE_INT); value_wid = gconf_value_new (GCONF_VALUE_INT);
} }
gconf_value_free (default_value);
g_assert (value_wid); g_assert (value_wid);
if (value_wid->type == GCONF_VALUE_INT) if (value_wid->type == GCONF_VALUE_INT)
@ -1150,7 +1149,7 @@ peditor_numeric_range_widget_changed (GConfPropertyEditor *peditor,
else if (value_wid->type == GCONF_VALUE_FLOAT) else if (value_wid->type == GCONF_VALUE_FLOAT)
gconf_value_set_float (value_wid, gtk_adjustment_get_value (adjustment)); gconf_value_set_float (value_wid, gtk_adjustment_get_value (adjustment));
else { else {
g_warning ("unable to set a gconf key for %s of type %d\n", g_warning ("unable to set a gconf key for %s of type %d",
peditor->p->key, peditor->p->key,
value_wid->type); value_wid->type);
gconf_value_free (value_wid); gconf_value_free (value_wid);