Browse Source

fix racey check of weak_ptr expiration

QGC4.4
Keith Bennett 4 years ago committed by Don Gagne
parent
commit
4ed9d992d9
  1. 3
      src/Vehicle/InitialConnectStateMachine.cc

3
src/Vehicle/InitialConnectStateMachine.cc

@ -97,12 +97,11 @@ void InitialConnectStateMachine::_stateRequestCapabilities(StateMachine* stateMa @@ -97,12 +97,11 @@ void InitialConnectStateMachine::_stateRequestCapabilities(StateMachine* stateMa
Vehicle* vehicle = connectMachine->_vehicle;
WeakLinkInterfacePtr weakLink = vehicle->vehicleLinkManager()->primaryLink();
SharedLinkInterfacePtr sharedLink = weakLink.lock();
if (weakLink.expired()) {
qCDebug(InitialConnectStateMachineLog) << "_stateRequestCapabilities Skipping capability request due to no primary link";
connectMachine->advance();
} else {
SharedLinkInterfacePtr sharedLink = weakLink.lock();
if (sharedLink->linkConfiguration()->isHighLatency() || sharedLink->isPX4Flow() || sharedLink->isLogReplay()) {
qCDebug(InitialConnectStateMachineLog) << "Skipping capability request due to link type";
connectMachine->advance();

Loading…
Cancel
Save