mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 05:45:35 +08:00
Shutdown guard
This commit is contained in:
@@ -56,6 +56,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CAircraftPartsHistory::initGui()
|
void CAircraftPartsHistory::initGui()
|
||||||
{
|
{
|
||||||
|
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextNetwork()) { return; }
|
||||||
const bool needCallsigns = this->partsHistoryEnabled();
|
const bool needCallsigns = this->partsHistoryEnabled();
|
||||||
if (needCallsigns && !m_timerUpdateHistory.isActive())
|
if (needCallsigns && !m_timerUpdateHistory.isActive())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -309,8 +309,10 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
void CSimulatorFsxCommon::onSimRunning()
|
void CSimulatorFsxCommon::onSimRunning()
|
||||||
{
|
{
|
||||||
|
const QPointer<CSimulatorFsxCommon> myself(this);
|
||||||
QTimer::singleShot(DeferSimulatingFlagMs, this, [ = ]
|
QTimer::singleShot(DeferSimulatingFlagMs, this, [ = ]
|
||||||
{
|
{
|
||||||
|
if (myself.isNull()) { return; }
|
||||||
m_simulatingChangedTs = QDateTime::currentMSecsSinceEpoch();
|
m_simulatingChangedTs = QDateTime::currentMSecsSinceEpoch();
|
||||||
this->onSimRunningDefered(m_simulatingChangedTs);
|
this->onSimRunningDefered(m_simulatingChangedTs);
|
||||||
});
|
});
|
||||||
@@ -567,9 +569,11 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
// we know the object has been created. But it can happen it is directly removed afterwards
|
// we know the object has been created. But it can happen it is directly removed afterwards
|
||||||
const CSimulatedAircraft verifyAircraft(simObject.getAircraft());
|
const CSimulatedAircraft verifyAircraft(simObject.getAircraft());
|
||||||
|
const QPointer<CSimulatorFsxCommon> myself(this);
|
||||||
QTimer::singleShot(1000, this, [ = ]
|
QTimer::singleShot(1000, this, [ = ]
|
||||||
{
|
{
|
||||||
// also triggers new add if required
|
// also triggers new add if required
|
||||||
|
if (myself.isNull()) { return; }
|
||||||
this->verifyAddedRemoteAircraft(verifyAircraft);
|
this->verifyAddedRemoteAircraft(verifyAircraft);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
@@ -1099,10 +1103,10 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cleanup function, actually this should not be needed
|
// cleanup function, actually this should not be needed
|
||||||
const QPointer<CSimulatorFsxCommon> guard(this);
|
const QPointer<CSimulatorFsxCommon> myself(this);
|
||||||
QTimer::singleShot(100, this, [ = ]
|
QTimer::singleShot(100, this, [ = ]
|
||||||
{
|
{
|
||||||
if (guard.isNull()) { return; }
|
if (myself.isNull()) { return; }
|
||||||
CSimulatorFsxCommon::physicallyRemoveAircraftNotInProvider();
|
CSimulatorFsxCommon::physicallyRemoveAircraftNotInProvider();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user