diff options
-rw-r--r-- | src/devices/nm-device.c | 19 | ||||
-rw-r--r-- | src/devices/nm-device.h | 2 | ||||
-rw-r--r-- | src/nm-manager.c | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 43c36b8e5d..a5b7f7b95d 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -157,6 +157,7 @@ typedef struct { gboolean enslaved; gboolean configure; guint watch_id; + guint remove_watch_id; } SlaveInfo; typedef struct { @@ -837,6 +838,7 @@ static void free_slave_info (SlaveInfo *info) { g_signal_handler_disconnect (info->slave, info->watch_id); + g_signal_handler_disconnect (info->slave, info->remove_watch_id); g_clear_object (&info->slave); memset (info, 0, sizeof (*info)); g_free (info); @@ -1590,6 +1592,23 @@ nm_device_get_enslaved (NMDevice *self) return NM_DEVICE_GET_PRIVATE (self)->enslaved; } +/** + * nm_device_removed: + * @self: the #NMDevice + * + * Called by the manager when the device was removed. Releases the device from + * the master in case it's enslaved. + */ +void +nm_device_removed (NMDevice *self) +{ + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + + if (priv->enslaved) + nm_device_release_one_slave (priv->master, self, TRUE, NM_DEVICE_STATE_REASON_REMOVED); +} + + static gboolean is_available (NMDevice *self) { diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index 840a19c08b..bae3392e2f 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -253,6 +253,8 @@ NMDevice * nm_device_get_master (NMDevice *dev); NMActRequest * nm_device_get_act_request (NMDevice *dev); NMConnection * nm_device_get_connection (NMDevice *dev); +void nm_device_removed (NMDevice *dev); + gboolean nm_device_is_available (NMDevice *dev); gboolean nm_device_has_carrier (NMDevice *dev); diff --git a/src/nm-manager.c b/src/nm-manager.c index 04192a98b1..2636cc4b93 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -762,6 +762,7 @@ remove_device (NMManager *manager, g_signal_emit (manager, signals[DEVICE_REMOVED], 0, device); g_object_notify (G_OBJECT (manager), NM_MANAGER_DEVICES); + nm_device_removed (device); nm_dbus_manager_unregister_object (priv->dbus_mgr, device); g_object_unref (device); |