From 1c031cddf7daa2b5328b2fc80c1d4d1e4063e82b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 9 Dec 2013 11:20:35 +0100 Subject: libnm-util: bugfix wrong diff result in nm_connection_diff Commit 6abc7b78f68e2e815bf8a8cec2a3235e35bb07e4 introduced a bug in nm_connection_diff() by not reading the property value with g_object_get_property(). Signed-off-by: Thomas Haller --- libnm-util/nm-setting.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'libnm-util/nm-setting.c') diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c index a0e287339b..bd06b90090 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -688,7 +688,6 @@ nm_setting_diff (NMSetting *a, for (i = 0; i < n_property_specs; i++) { GParamSpec *prop_spec = property_specs[i]; - GValue a_value = G_VALUE_INIT, b_value = G_VALUE_INIT; NMSettingDiffResult r = NM_SETTING_DIFF_RESULT_UNKNOWN, tmp; gboolean different = TRUE; @@ -701,16 +700,19 @@ nm_setting_diff (NMSetting *a, if (b) { different = !NM_SETTING_GET_CLASS (a)->compare_property (a, b, prop_spec, flags); if (different) { - g_value_init (&a_value, prop_spec->value_type); - g_value_init (&b_value, prop_spec->value_type); + GValue value = G_VALUE_INIT; - if (!g_param_value_defaults (prop_spec, &a_value)) + g_value_init (&value, prop_spec->value_type); + g_object_get_property (G_OBJECT (a), prop_spec->name, &value); + if (!g_param_value_defaults (prop_spec, &value)) r |= a_result; - if (!g_param_value_defaults (prop_spec, &b_value)) + + g_value_reset (&value); + g_object_get_property (G_OBJECT (b), prop_spec->name, &value); + if (!g_param_value_defaults (prop_spec, &value)) r |= b_result; - g_value_unset (&a_value); - g_value_unset (&b_value); + g_value_unset (&value); } } else r = a_result; /* only in A */ -- cgit v1.2.1