mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 19:00:11 +01:00
device: cleanup unrealized device without connection
During nm_device_unrealize(), the connection might still
have some connections that only get removed later. We must
garbage collect unrealized devices when they loose their
available-connections, not during unrealize.
Fixes: 436ec5b8e3
This commit is contained in:
parent
eab9cca87c
commit
9c2266741b
1 changed files with 18 additions and 4 deletions
|
|
@ -2082,8 +2082,6 @@ nm_device_unrealize (NMDevice *self, gboolean remove_resources, GError **error)
|
|||
|
||||
/* Garbage-collect unneeded unrealized devices. */
|
||||
nm_device_recheck_available_connections (self);
|
||||
if (g_hash_table_size (priv->available_connections) == 0)
|
||||
g_signal_emit_by_name (self, NM_DEVICE_REMOVED);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -9086,6 +9084,16 @@ _del_available_connection (NMDevice *self, NMConnection *connection)
|
|||
return g_hash_table_remove (NM_DEVICE_GET_PRIVATE (self)->available_connections, connection);
|
||||
}
|
||||
|
||||
static void
|
||||
available_connection_check_delete_unrealized (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
||||
|
||||
if ( g_hash_table_size (priv->available_connections) == 0
|
||||
&& !nm_device_is_real (self))
|
||||
g_signal_emit_by_name (self, NM_DEVICE_REMOVED);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_connection_available (NMDevice *self,
|
||||
NMConnection *connection,
|
||||
|
|
@ -9132,6 +9140,8 @@ nm_device_recheck_available_connections (NMDevice *self)
|
|||
|
||||
_signal_available_connections_changed (self);
|
||||
}
|
||||
|
||||
available_connection_check_delete_unrealized (self);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -9188,8 +9198,10 @@ cp_connection_removed (NMConnectionProvider *cp, NMConnection *connection, gpoin
|
|||
|
||||
g_return_if_fail (NM_IS_DEVICE (self));
|
||||
|
||||
if (_del_available_connection (self, connection))
|
||||
if (_del_available_connection (self, connection)) {
|
||||
_signal_available_connections_changed (self);
|
||||
available_connection_check_delete_unrealized (self);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -9205,8 +9217,10 @@ cp_connection_updated (NMConnectionProvider *cp, NMConnection *connection, gpoin
|
|||
added = _try_add_available_connection (self, connection);
|
||||
|
||||
/* Only signal if the connection was removed OR added, but not both */
|
||||
if (added != deleted)
|
||||
if (added != deleted) {
|
||||
_signal_available_connections_changed (self);
|
||||
available_connection_check_delete_unrealized (self);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue