From 023ebd8eebb7bb705097d970f710d76f26fd356b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 20 Nov 2018 14:41:14 +0100 Subject: [PATCH] manager: use nm_device_disconnect_active_connection() in nm_manager_deactivate_connection() We should not blindly change the device's state. Instead, call nm_device_disconnect_active_connection() which will figure out whether the device state needs to change. Note that it is very possible that the active-connection instance is still queued, not yet queued, or already disconnected. nm_device_disconnect_active_connection() does the right thing in all cases. --- src/nm-manager.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/nm-manager.c b/src/nm-manager.c index 648cc611b0..4c9b11a524 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -5420,10 +5420,10 @@ nm_manager_deactivate_connection (NMManager *manager, return FALSE; } } else { - g_assert (NM_IS_ACT_REQUEST (active)); - nm_device_state_changed (nm_active_connection_get_device (active), - NM_DEVICE_STATE_DEACTIVATING, - reason); + nm_assert (NM_IS_ACT_REQUEST (active)); + nm_device_disconnect_active_connection (active, + reason, + NM_ACTIVE_CONNECTION_STATE_REASON_UNKNOWN); } _notify (manager, PROP_ACTIVE_CONNECTIONS);