policy: prevent double-deactivation of an NMActiveConnection after it's removed
When a connection is removed from NMSettings, it gets deactivated. That was happening once in response to the now-removed connection's visibility changing to invisible to everyone, and a second time in response to the actual removal signal. Unfortunately the second time the NMActiveConnection is already cleaned up and in the DEACTIVATED state, and has no priv->device, which causes great hilarity when nm_device_set_state() is called with NULL. _deactivate_if_active() should only try to deactivate NMActiveConnections that actually are active.
This commit is contained in:
@@ -1811,9 +1811,11 @@ _deactivate_if_active (NMManager *manager, NMConnection *connection)
|
||||
active = nm_manager_get_active_connections (manager);
|
||||
for (iter = active; iter; iter = g_slist_next (iter)) {
|
||||
NMActiveConnection *ac = iter->data;
|
||||
NMActiveConnectionState state = nm_active_connection_get_state (ac);
|
||||
GError *error = NULL;
|
||||
|
||||
if (nm_active_connection_get_connection (ac) == connection) {
|
||||
if (nm_active_connection_get_connection (ac) == connection &&
|
||||
(state <= NM_ACTIVE_CONNECTION_STATE_ACTIVATED)) {
|
||||
if (!nm_manager_deactivate_connection (manager,
|
||||
nm_active_connection_get_path (ac),
|
||||
NM_DEVICE_STATE_REASON_CONNECTION_REMOVED,
|
||||
|
Reference in New Issue
Block a user