mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 02:00:14 +01:00
core: in NMPolicy's _deactivate_if_active() safely iterate over active connections
It's not clear that calling nm_manager_deactivate_connection() does not remove the active-connection entirely from the list. Just to be sure, use nm_manager_for_each_active_connection_safe() which allows deleting the current entry while iterating (all other modifications to the list are not allowed).
This commit is contained in:
parent
936c6d0b0a
commit
83d1231348
1 changed files with 2 additions and 2 deletions
|
|
@ -2404,12 +2404,12 @@ _deactivate_if_active (NMPolicy *self, NMSettingsConnection *connection)
|
|||
{
|
||||
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (self);
|
||||
NMActiveConnection *ac;
|
||||
const CList *tmp_list;
|
||||
const CList *tmp_list, *tmp_safe;
|
||||
GError *error = NULL;
|
||||
|
||||
nm_assert (NM_IS_SETTINGS_CONNECTION (connection));
|
||||
|
||||
nm_manager_for_each_active_connection (priv->manager, ac, tmp_list) {
|
||||
nm_manager_for_each_active_connection_safe (priv->manager, ac, tmp_list, tmp_safe) {
|
||||
|
||||
if ( nm_active_connection_get_settings_connection (ac) == connection
|
||||
&& (nm_active_connection_get_state (ac) <= NM_ACTIVE_CONNECTION_STATE_ACTIVATED)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue