mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 08:18:03 +02:00
2007-11-21 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-vpn-properties.c - (set_property): must deep-copy the given settings hash, otherwise double-free errors occur when the setting is disposed of git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3102 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
a2c202ed8d
commit
f2b002c3de
2 changed files with 23 additions and 1 deletions
|
|
@ -1,3 +1,9 @@
|
||||||
|
2007-11-21 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* libnm-util/nm-setting-vpn-properties.c
|
||||||
|
- (set_property): must deep-copy the given settings hash, otherwise
|
||||||
|
double-free errors occur when the setting is disposed of
|
||||||
|
|
||||||
2007-11-21 Dan Williams <dcbw@redhat.com>
|
2007-11-21 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* src/vpn-manager/nm-vpn-act-request.h
|
* src/vpn-manager/nm-vpn-act-request.h
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,19 @@ finalize (GObject *object)
|
||||||
G_OBJECT_CLASS (nm_setting_vpn_properties_parent_class)->finalize (object);
|
G_OBJECT_CLASS (nm_setting_vpn_properties_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
copy_hash (gpointer key, gpointer data, gpointer user_data)
|
||||||
|
{
|
||||||
|
NMSettingVPNProperties *setting = NM_SETTING_VPN_PROPERTIES (user_data);
|
||||||
|
GValue *src_val = (GValue *) data;
|
||||||
|
GValue *copy_val;
|
||||||
|
|
||||||
|
copy_val = g_slice_new0 (GValue);
|
||||||
|
g_value_init (copy_val, G_VALUE_TYPE (src_val));
|
||||||
|
g_value_copy (src_val, copy_val);
|
||||||
|
g_hash_table_insert (setting->data, g_strdup (key), copy_val);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_property (GObject *object, guint prop_id,
|
set_property (GObject *object, guint prop_id,
|
||||||
const GValue *value, GParamSpec *pspec)
|
const GValue *value, GParamSpec *pspec)
|
||||||
|
|
@ -85,7 +98,10 @@ set_property (GObject *object, guint prop_id,
|
||||||
case PROP_DATA:
|
case PROP_DATA:
|
||||||
if (setting->data)
|
if (setting->data)
|
||||||
g_hash_table_destroy (setting->data);
|
g_hash_table_destroy (setting->data);
|
||||||
setting->data = g_value_dup_boxed (value);
|
|
||||||
|
/* Must make a deep copy of the hash table here... */
|
||||||
|
setting->data = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy);
|
||||||
|
g_hash_table_foreach (g_value_get_boxed (value), copy_hash, setting);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue