diff --git a/ChangeLog b/ChangeLog index f04871fcff..bf9fdaf860 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-09-23 Dan Williams + + * libnm-util/nm-setting.c + - (property_value_destroy, nm_setting_vpn_properties_new): initialize + the hash table in a standard manner. Clients of libnm-util should + only call g_hash_table_remove_all(), never destroy the hash table + and recreate it. + 2007-09-22 Dan Williams * src/nm-device-802-11-wireless.c diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c index 60153f29fd..af02ea6683 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -1248,6 +1248,15 @@ setting_vpn_properties_destroy (NMSetting *setting) g_slice_free (NMSettingVPNProperties, self); } +static void +property_value_destroy (gpointer data) +{ + GValue *value = (GValue *) data; + + g_value_unset (value); + g_slice_free (GValue, data); +} + static SettingMember vpn_properties_table[] = { { "data", NM_S_TYPE_GVALUE_HASH, G_STRUCT_OFFSET (NMSettingVPNProperties, data), TRUE, FALSE }, { NULL, 0, 0 }, @@ -1257,6 +1266,7 @@ NMSetting * nm_setting_vpn_properties_new (void) { NMSetting *setting; + NMSettingVPNProperties *s_vpn_props; setting = (NMSetting *) g_slice_new0 (NMSettingVPNProperties); @@ -1266,6 +1276,11 @@ nm_setting_vpn_properties_new (void) setting->hash_fn = setting_vpn_properties_hash; setting->destroy_fn = setting_vpn_properties_destroy; + s_vpn_props = (NMSettingVPNProperties *) setting; + s_vpn_props->data = g_hash_table_new_full (g_str_hash, g_str_equal, + (GDestroyNotify) g_free, + property_value_destroy); + return setting; }