mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
Ref T786, further checks (shutdown, empty values)
This commit is contained in:
committed by
Mat Sutcliffe
parent
2156eb1831
commit
17cebfb8d3
@@ -174,7 +174,7 @@ namespace BlackCore
|
|||||||
void ISimulator::reloadWeatherSettings()
|
void ISimulator::reloadWeatherSettings()
|
||||||
{
|
{
|
||||||
// log crash info about weather
|
// log crash info about weather
|
||||||
if (sApp && !sApp->isShuttingDown()) { CCrashHandler::instance()->crashAndLogAppendInfo(u"Simulator weather: " % boolToYesNo(m_isWeatherActivated)); }
|
if (this->isShuttingDown()) { CCrashHandler::instance()->crashAndLogAppendInfo(u"Simulator weather: " % boolToYesNo(m_isWeatherActivated)); }
|
||||||
if (!m_isWeatherActivated) { return; }
|
if (!m_isWeatherActivated) { return; }
|
||||||
m_lastWeatherPosition.setNull();
|
m_lastWeatherPosition.setNull();
|
||||||
const CWeatherScenario selectedWeatherScenario = m_weatherScenarioSettings.get();
|
const CWeatherScenario selectedWeatherScenario = m_weatherScenarioSettings.get();
|
||||||
@@ -196,7 +196,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
// log crash info about weather
|
// log crash info about weather
|
||||||
if (sApp && !sApp->isShuttingDown()) { CCrashHandler::instance()->crashAndLogAppendInfo(selectedWeatherScenario.toQString(true)); }
|
if (this->isShuttingDown()) { CCrashHandler::instance()->crashAndLogAppendInfo(selectedWeatherScenario.toQString(true)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISimulator::clearAllRemoteAircraftData()
|
void ISimulator::clearAllRemoteAircraftData()
|
||||||
@@ -1384,7 +1384,7 @@ namespace BlackCore
|
|||||||
const QPointer<ISimulator> myself(this);
|
const QPointer<ISimulator> myself(this);
|
||||||
QTimer::singleShot(t, this, [ = ]
|
QTimer::singleShot(t, this, [ = ]
|
||||||
{
|
{
|
||||||
if (myself.isNull() || myself->isShuttingDown()) { return; }
|
if (!myself || myself->isShuttingDown()) { return; }
|
||||||
this->displayLoggedSituationInSimulator(cs, stopLogging, times - 1);
|
this->displayLoggedSituationInSimulator(cs, stopLogging, times - 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -467,6 +467,8 @@ namespace BlackSimPlugin
|
|||||||
void CSimulatorFs9::injectWeatherGrid(const CWeatherGrid &weatherGrid)
|
void CSimulatorFs9::injectWeatherGrid(const CWeatherGrid &weatherGrid)
|
||||||
{
|
{
|
||||||
if (this->isShuttingDownOrDisconnected()) { return; }
|
if (this->isShuttingDownOrDisconnected()) { return; }
|
||||||
|
if (weatherGrid.isEmpty()) { return; }
|
||||||
|
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
||||||
{
|
{
|
||||||
BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread");
|
BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread");
|
||||||
|
|||||||
@@ -2395,6 +2395,8 @@ namespace BlackSimPlugin
|
|||||||
void CSimulatorFsxCommon::injectWeatherGrid(const CWeatherGrid &weatherGrid)
|
void CSimulatorFsxCommon::injectWeatherGrid(const CWeatherGrid &weatherGrid)
|
||||||
{
|
{
|
||||||
if (this->isShuttingDownOrDisconnected()) { return; }
|
if (this->isShuttingDownOrDisconnected()) { return; }
|
||||||
|
if (weatherGrid.isEmpty()) { return; }
|
||||||
|
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
||||||
{
|
{
|
||||||
BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread");
|
BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread");
|
||||||
@@ -2817,7 +2819,7 @@ namespace BlackSimPlugin
|
|||||||
QPointer<CSimulatorFsxCommonListener> myself(this);
|
QPointer<CSimulatorFsxCommonListener> myself(this);
|
||||||
QTimer::singleShot(0, this, [ = ]
|
QTimer::singleShot(0, this, [ = ]
|
||||||
{
|
{
|
||||||
if (!myself) { return; }
|
if (!myself || !sApp || sApp->isShuttingDown()) { return; }
|
||||||
this->checkConnection();
|
this->checkConnection();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -2837,13 +2839,15 @@ namespace BlackSimPlugin
|
|||||||
bool check = false;
|
bool check = false;
|
||||||
if (isOk(result))
|
if (isOk(result))
|
||||||
{
|
{
|
||||||
|
// if we can connect, but not dispatch, it can mean a previously started FSX/P3D
|
||||||
|
// blocks remote calls -> RESTART
|
||||||
for (int i = 0; !check && i < 3 && !this->isShuttingDown(); i++)
|
for (int i = 0; !check && i < 3 && !this->isShuttingDown(); i++)
|
||||||
{
|
{
|
||||||
// result not always in first dispatch as we first have to obtain simulator name
|
// result not always in first dispatch as we first have to obtain simulator name
|
||||||
result = SimConnect_CallDispatch(hSimConnect, CSimulatorFsxCommonListener::SimConnectProc, this);
|
result = SimConnect_CallDispatch(hSimConnect, CSimulatorFsxCommonListener::SimConnectProc, this);
|
||||||
if (isFailure(result)) { break; } // means serious failure
|
if (isFailure(result)) { break; } // means serious failure
|
||||||
check = this->checkVersionAndSimulator();
|
check = this->checkVersionAndSimulator();
|
||||||
if (!check) { sApp->processEventsFor(500); }
|
if (!check && sApp) { sApp->processEventsFor(500); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SimConnect_Close(hSimConnect);
|
SimConnect_Close(hSimConnect);
|
||||||
|
|||||||
@@ -897,8 +897,11 @@ namespace BlackSimPlugin
|
|||||||
void CSimulatorXPlane::injectWeatherGrid(const CWeatherGrid &weatherGrid)
|
void CSimulatorXPlane::injectWeatherGrid(const CWeatherGrid &weatherGrid)
|
||||||
{
|
{
|
||||||
if (this->isShuttingDownOrDisconnected()) { return; }
|
if (this->isShuttingDownOrDisconnected()) { return; }
|
||||||
|
if (weatherGrid.isEmpty()) { return; }
|
||||||
|
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
||||||
{
|
{
|
||||||
|
|
||||||
BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread");
|
BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread");
|
||||||
QPointer<CSimulatorXPlane> myself(this);
|
QPointer<CSimulatorXPlane> myself(this);
|
||||||
QTimer::singleShot(0, this, [ = ]
|
QTimer::singleShot(0, this, [ = ]
|
||||||
|
|||||||
Reference in New Issue
Block a user