Avoid ASSERT in XPlane "rapid shutdown"

This commit is contained in:
Klaus Basan
2019-08-21 14:57:31 +02:00
committed by Mat Sutcliffe
parent a2a186a2f5
commit 105db27fa8

View File

@@ -635,7 +635,9 @@ namespace BlackSimPlugin
bool CSimulatorXPlane::physicallyAddRemoteAircraft(const CSimulatedAircraft &newRemoteAircraft) bool CSimulatorXPlane::physicallyAddRemoteAircraft(const CSimulatedAircraft &newRemoteAircraft)
{ {
Q_ASSERT(isConnected()); // avoid issue in rapid shutdown
if (this->isShuttingDownOrDisconnected()) { return false; }
// entry checks // entry checks
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread"); Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
Q_ASSERT_X(!newRemoteAircraft.getCallsign().isEmpty(), Q_FUNC_INFO, "empty callsign"); Q_ASSERT_X(!newRemoteAircraft.getCallsign().isEmpty(), Q_FUNC_INFO, "empty callsign");
@@ -684,7 +686,8 @@ namespace BlackSimPlugin
bool CSimulatorXPlane::physicallyRemoveRemoteAircraft(const CCallsign &callsign) bool CSimulatorXPlane::physicallyRemoveRemoteAircraft(const CCallsign &callsign)
{ {
Q_ASSERT(this->isConnected()); // avoid issue in rapid shutdown
if (this->isShuttingDownOrDisconnected()) { return false; }
// only remove from sim // only remove from sim
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "wrong thread"); Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "wrong thread");