mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 08:48:07 +02:00
device/veth: don't use notify() signal to bind changes for "peer" property
The notify() signal is not emitted while the object properties are blocked via g_object_freeze_notify(). That makes is unsuitable to emit a notification for "peer" property whenver the device's "parent" property changes. Because especially with freeze/thaw, we want to emit both signals in the same batch, not first emit change signals for "parent", and then in a second run the signals for "peer". Use the existing parent_changed_notify() virtual function instead.
This commit is contained in:
parent
062f86d88e
commit
34493c5134
1 changed files with 12 additions and 5 deletions
|
|
@ -101,11 +101,18 @@ nm_device_veth_init (NMDeviceVeth *self)
|
|||
}
|
||||
|
||||
static void
|
||||
notify (GObject *object, GParamSpec *pspec)
|
||||
parent_changed_notify (NMDevice *device,
|
||||
int old_ifindex,
|
||||
NMDevice *old_parent,
|
||||
int new_ifindex,
|
||||
NMDevice *new_parent)
|
||||
{
|
||||
if (nm_streq (pspec->name, NM_DEVICE_PARENT))
|
||||
_notify (NM_DEVICE_VETH (object), PROP_PEER);
|
||||
G_OBJECT_CLASS (nm_device_veth_parent_class)->notify (object, pspec);
|
||||
NM_DEVICE_CLASS (nm_device_veth_parent_class)->parent_changed_notify (device,
|
||||
old_ifindex,
|
||||
old_parent,
|
||||
new_ifindex,
|
||||
new_parent);
|
||||
_notify (NM_DEVICE_VETH (device), PROP_PEER);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -137,10 +144,10 @@ nm_device_veth_class_init (NMDeviceVethClass *klass)
|
|||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_VETH)
|
||||
|
||||
object_class->get_property = get_property;
|
||||
object_class->notify = notify;
|
||||
|
||||
device_class->can_unmanaged_external_down = can_unmanaged_external_down;
|
||||
device_class->link_changed = link_changed;
|
||||
device_class->parent_changed_notify = parent_changed_notify;
|
||||
|
||||
obj_properties[PROP_PEER] =
|
||||
g_param_spec_string (NM_DEVICE_VETH_PEER, "", "",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue