core: better ignore deactivations before a new activation starts (rh #1058843)
When a new activation request comes in and the device is already activated, two NMActRequests will exist for the device in parallel. The old one handles de-activation of the device and is then disposed, while the new one waits until the device is de-activated and then takes over and starts the new activation. Both requests are watching device state, and the new request may mis-interpret the de-activation states and clean up its device pointer, leading to assertion failures when the new activation starts. To fix this (and because NMVPNConnection *does* always want to see de-activation events from the device) remove the code that tries to ignore de-activation from NMActiveConnection's device state handler. Instead, have NMActRequest skip any reaction to device state changes unless it is the current activation request on the device. The VPN code always wants to see the device's state, so it doesn't need this check.
This commit is contained in:
@@ -307,6 +307,10 @@ device_state_changed (NMActiveConnection *active,
|
||||
{
|
||||
NMActiveConnectionState ac_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
|
||||
|
||||
/* Ignore state changes when this activation request is not yet active */
|
||||
if (NM_ACTIVE_CONNECTION (nm_device_get_act_request (device)) != active)
|
||||
return;
|
||||
|
||||
/* Set NMActiveConnection state based on the device's state */
|
||||
switch (new_state) {
|
||||
case NM_DEVICE_STATE_PREPARE:
|
||||
|
Reference in New Issue
Block a user