diff options
author | Thomas Haller <thaller@redhat.com> | 2018-03-05 15:23:31 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-03-12 18:03:07 +0100 |
commit | 8b75f10ebe5714e1872f0376317b85c57569db9c (patch) | |
tree | e1f20c30e4136430b0ef63ed05941ceb591c95d5 /src/devices/nm-device-macvlan.c | |
parent | 34493c513426ab06221b50ec13732ff090990e7a (diff) | |
download | NetworkManager-8b75f10ebe5714e1872f0376317b85c57569db9c.tar.gz |
device: set properties before emitting the change notification
The change doesn't really make a difference. I thought it would, so I
did it. But turns out (as the code correctly assumes), while the
notifications are frozen, it's OK to leave the property still in an
inconsistent state while emitting the notify signal.
Still, it feels slightly more correct this way, so keep the change.
Diffstat (limited to 'src/devices/nm-device-macvlan.c')
-rw-r--r-- | src/devices/nm-device-macvlan.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/devices/nm-device-macvlan.c b/src/devices/nm-device-macvlan.c index 2a461543b0..a336012909 100644 --- a/src/devices/nm-device-macvlan.c +++ b/src/devices/nm-device-macvlan.c @@ -197,12 +197,17 @@ update_properties (NMDevice *device) g_object_freeze_notify (object); nm_device_parent_set_ifindex (device, plink->parent); - if (priv->props.mode != props->mode) - _notify (self, PROP_MODE); - if (priv->props.no_promisc != props->no_promisc) - _notify (self, PROP_NO_PROMISC); - priv->props = *props; +#define CHECK_PROPERTY_CHANGED(field, prop) \ + G_STMT_START { \ + if (priv->props.field != props->field) { \ + priv->props.field = props->field; \ + _notify (self, prop); \ + } \ + } G_STMT_END + + CHECK_PROPERTY_CHANGED (mode, PROP_MODE); + CHECK_PROPERTY_CHANGED (no_promisc, PROP_NO_PROMISC); g_object_thaw_notify (object); } |