mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 03:45:30 +08:00
refs #935, avoid issues when shutting down
This commit is contained in:
committed by
Mathew Sutcliffe
parent
d475246941
commit
f34e80ea62
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "blackcore/simulator.h"
|
#include "blackcore/simulator.h"
|
||||||
|
#include "blackcore/application.h"
|
||||||
|
|
||||||
#include <QFlag>
|
#include <QFlag>
|
||||||
#include <Qt>
|
#include <Qt>
|
||||||
@@ -83,6 +84,11 @@ namespace BlackCore
|
|||||||
return m_info.toQString();
|
return m_info.toQString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ISimulatorListener::isShuttingDown() const
|
||||||
|
{
|
||||||
|
return (!sApp || sApp->isShuttingDown());
|
||||||
|
}
|
||||||
|
|
||||||
void ISimulatorListener::start()
|
void ISimulatorListener::start()
|
||||||
{
|
{
|
||||||
if (m_isRunning) { return; }
|
if (m_isRunning) { return; }
|
||||||
@@ -92,7 +98,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void ISimulatorListener::stop()
|
void ISimulatorListener::stop()
|
||||||
{
|
{
|
||||||
if(!m_isRunning) { return; }
|
if (!m_isRunning) { return; }
|
||||||
stopImpl();
|
stopImpl();
|
||||||
m_isRunning = false;
|
m_isRunning = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,6 +151,9 @@ namespace BlackCore
|
|||||||
//! Driver will be unloaded
|
//! Driver will be unloaded
|
||||||
virtual void unload() = 0;
|
virtual void unload() = 0;
|
||||||
|
|
||||||
|
//! Is overall (swift) application shutting down
|
||||||
|
virtual bool isShuttingDown() const = 0;
|
||||||
|
|
||||||
//! Set interpolation mode, empty callsign applies to all know callsigns
|
//! Set interpolation mode, empty callsign applies to all know callsigns
|
||||||
virtual bool setInterpolatorMode(BlackMisc::Simulation::CInterpolatorMulti::Mode mode, const BlackMisc::Aviation::CCallsign &callsign) = 0;
|
virtual bool setInterpolatorMode(BlackMisc::Simulation::CInterpolatorMulti::Mode mode, const BlackMisc::Aviation::CCallsign &callsign) = 0;
|
||||||
|
|
||||||
@@ -253,6 +256,9 @@ namespace BlackCore
|
|||||||
//! Info about the backend system (if available)
|
//! Info about the backend system (if available)
|
||||||
virtual QString backendInfo() const;
|
virtual QString backendInfo() const;
|
||||||
|
|
||||||
|
//! Overall (swift) application shutting down
|
||||||
|
virtual bool isShuttingDown() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! Start listening for the simulator to start.
|
//! Start listening for the simulator to start.
|
||||||
void start();
|
void start();
|
||||||
|
|||||||
@@ -291,6 +291,11 @@ namespace BlackCore
|
|||||||
this->m_remoteAircraftProviderConnections.disconnectAll(); // disconnect signals from provider
|
this->m_remoteAircraftProviderConnections.disconnectAll(); // disconnect signals from provider
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSimulatorCommon::isShuttingDown() const
|
||||||
|
{
|
||||||
|
return (!sApp || sApp->isShuttingDown());
|
||||||
|
}
|
||||||
|
|
||||||
void CSimulatorCommon::setInterpolationAndRenderingSetup(const CInterpolationAndRenderingSetup &setup)
|
void CSimulatorCommon::setInterpolationAndRenderingSetup(const CInterpolationAndRenderingSetup &setup)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ namespace BlackCore
|
|||||||
virtual BlackMisc::Aviation::CAirportList getAirportsInRange() const override;
|
virtual BlackMisc::Aviation::CAirportList getAirportsInRange() const override;
|
||||||
virtual void setWeatherActivated(bool activated) override;
|
virtual void setWeatherActivated(bool activated) override;
|
||||||
virtual void unload() override;
|
virtual void unload() override;
|
||||||
|
virtual bool isShuttingDown() const override;
|
||||||
virtual int physicallyRemoveMultipleRemoteAircraft(const BlackMisc::Aviation::CCallsignSet &callsigns) override;
|
virtual int physicallyRemoveMultipleRemoteAircraft(const BlackMisc::Aviation::CCallsignSet &callsigns) override;
|
||||||
|
|
||||||
//! \addtogroup swiftdotcommands
|
//! \addtogroup swiftdotcommands
|
||||||
|
|||||||
@@ -1356,7 +1356,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
void CSimulatorFsxCommonListener::checkConnection()
|
void CSimulatorFsxCommonListener::checkConnection()
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(sApp, Q_FUNC_INFO, "Missing sApp");
|
if (this->isShuttingDown()) { return; }
|
||||||
Q_ASSERT_X(!CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "Expect to run in background");
|
Q_ASSERT_X(!CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "Expect to run in background");
|
||||||
HANDLE hSimConnect;
|
HANDLE hSimConnect;
|
||||||
HRESULT result = SimConnect_Open(&hSimConnect, sApp->swiftVersionChar(), nullptr, 0, 0, 0);
|
HRESULT result = SimConnect_Open(&hSimConnect, sApp->swiftVersionChar(), nullptr, 0, 0, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user