aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ephy-dialog.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-05-16 02:08:38 +0800
committerChristian Persch <chpe@src.gnome.org>2004-05-16 02:08:38 +0800
commit7e18677c220c8c1b81d5240c5658553ee1d2ae79 (patch)
tree613ed37ad1e9dbfab6f68d92fc667ae2dd595b7a /lib/ephy-dialog.c
parent7933945474d076b7f0b4819e0a737c0ffe6c8d45 (diff)
downloadgsoc2013-epiphany-7e18677c220c8c1b81d5240c5658553ee1d2ae79.tar
gsoc2013-epiphany-7e18677c220c8c1b81d5240c5658553ee1d2ae79.tar.gz
gsoc2013-epiphany-7e18677c220c8c1b81d5240c5658553ee1d2ae79.tar.bz2
gsoc2013-epiphany-7e18677c220c8c1b81d5240c5658553ee1d2ae79.tar.lz
gsoc2013-epiphany-7e18677c220c8c1b81d5240c5658553ee1d2ae79.tar.xz
gsoc2013-epiphany-7e18677c220c8c1b81d5240c5658553ee1d2ae79.tar.zst
gsoc2013-epiphany-7e18677c220c8c1b81d5240c5658553ee1d2ae79.zip
Fix mem leak.
2004-05-15 Christian Persch <chpe@cvs.gnome.org> * lib/ephy-dialog.c: (set_value_from_editable), (set_value_from_radiobuttongroup), (set_value_from_spin_button), (set_value_from_togglebutton), (set_combo_box_from_value): Fix mem leak.
Diffstat (limited to 'lib/ephy-dialog.c')
-rw-r--r--lib/ephy-dialog.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c
index 05e6c94c1..9d0ee28af 100644
--- a/lib/ephy-dialog.c
+++ b/lib/ephy-dialog.c
@@ -254,6 +254,7 @@ set_value_from_editable (PropertyInfo *info, GValue *value)
break;
default:
retval = FALSE;
+ g_value_unset (value);
g_warning ("Unsupported value type for editable %s", info->id);
break;
}
@@ -346,16 +347,17 @@ set_value_from_radiobuttongroup (PropertyInfo *info, GValue *value)
index = get_radio_button_active_index (info->widget);
g_return_val_if_fail (index >= 0, FALSE);
- g_value_init (value, info->data_type);
if (info->data_type == G_TYPE_STRING)
{
g_return_val_if_fail (info->string_enum != NULL, FALSE);
g_return_val_if_fail (g_list_nth_data (info->string_enum, index) != NULL, FALSE);
+ g_value_init (value, G_TYPE_STRING);
g_value_set_string (value, (char*) g_list_nth_data (info->string_enum, index));
}
else if (info->data_type == G_TYPE_INT)
{
+ g_value_init (value, G_TYPE_INT);
g_value_set_int (value, index);
}
else
@@ -380,13 +382,14 @@ set_value_from_spin_button (PropertyInfo *info, GValue *value)
is_int = (gtk_spin_button_get_digits (GTK_SPIN_BUTTON(info->widget)) == 0);
- g_value_init (value, info->data_type);
if (info->data_type == G_TYPE_INT && is_int)
{
+ g_value_init (value, G_TYPE_INT);
g_value_set_int (value, (int) f);
}
else if (info->data_type == G_TYPE_FLOAT)
{
+ g_value_init (value, G_TYPE_FLOAT);
g_value_set_float (value, f);
}
else
@@ -408,9 +411,9 @@ set_value_from_togglebutton (PropertyInfo *info, GValue *value)
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (info->widget));
- g_value_init (value, info->data_type);
if (info->data_type == G_TYPE_BOOLEAN)
{
+ g_value_init (value, info->data_type);
g_value_set_boolean (value, active);
}
else
@@ -585,6 +588,7 @@ set_combo_box_from_value (PropertyInfo *info, const GValue *value)
else
{
char *v;
+
gtk_combo_box_set_active (GTK_COMBO_BOX (info->widget), -1);
v = g_strdup_value_contents (value);