From f607a16994eab9c587656f5fe2036d51e9eefa67 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 19 Jan 2016 13:52:21 +0100 Subject: [PATCH] device/macvlan: implement dispose() When the object gets disposed, parent must be unreferenced and signals disconnected. Fixes: 4de8851eca06d797f1a3c89f5710d51018ca2bff https://bugzilla.redhat.com/show_bug.cgi?id=1299803 --- src/devices/nm-device-macvlan.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/devices/nm-device-macvlan.c b/src/devices/nm-device-macvlan.c index 8123a7931f..6f3ac4b181 100644 --- a/src/devices/nm-device-macvlan.c +++ b/src/devices/nm-device-macvlan.c @@ -139,8 +139,7 @@ nm_device_macvlan_set_parent (NMDeviceMacvlan *self, NMDevice *parent) if (parent == priv->parent) return; - if (priv->parent_state_id) - nm_clear_g_signal_handler (priv->parent, &priv->parent_state_id); + nm_clear_g_signal_handler (priv->parent, &priv->parent_state_id); g_clear_object (&priv->parent); @@ -620,6 +619,14 @@ set_property (GObject *object, guint prop_id, } } +static void +dispose (GObject *object) +{ + nm_device_macvlan_set_parent (NM_DEVICE_MACVLAN (object), NULL); + + G_OBJECT_CLASS (nm_device_macvlan_parent_class)->dispose (object); +} + static void nm_device_macvlan_class_init (NMDeviceMacvlanClass *klass) { @@ -630,6 +637,7 @@ nm_device_macvlan_class_init (NMDeviceMacvlanClass *klass) NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_MACVLAN, NM_LINK_TYPE_MACVTAP) + object_class->dispose = dispose; object_class->get_property = get_property; object_class->set_property = set_property;