device: Remove unmanaged slaves from master when they disappear

We've previously been just watching for state changes into UNMANAGED state. No
state change is emitted upon removal of a device which is already unmanaged.

https://bugzilla.gnome.org/show_bug.cgi?id=737659
This commit is contained in:
Lubomir Rintel 2014-11-16 16:07:22 +01:00
parent e2f489ebda
commit c83b40aca7
3 changed files with 20 additions and 0 deletions

View file

@ -1602,6 +1602,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)
{

View file

@ -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);

View file

@ -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);