mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
refs #431, infinite recursion in driver unload
* Trivial changes to avoid changedStatus signal when nothing changed * Do not reload plugin when already loaded
This commit is contained in:
@@ -96,7 +96,7 @@ namespace BlackSimPlugin
|
||||
|
||||
bool CSimulatorFs9::disconnectFrom()
|
||||
{
|
||||
if (!m_simConnected) return true;
|
||||
if (!m_simConnected) { return true; }
|
||||
|
||||
// Don't forward messages when disconnected
|
||||
disconnect(m_connectionHostMessages);
|
||||
|
||||
@@ -80,12 +80,13 @@ namespace BlackSimPlugin
|
||||
bool CSimulatorFsx::connectTo()
|
||||
{
|
||||
if (m_simConnected) { return true; }
|
||||
int oldStatus = getSimulatorStatus();
|
||||
if (FAILED(SimConnect_Open(&m_hSimConnect, BlackMisc::CProject::systemNameAndVersionChar(), nullptr, 0, 0, 0)))
|
||||
{
|
||||
m_simConnected = false;
|
||||
m_simPaused = false;
|
||||
m_simSimulating = false;
|
||||
emitSimulatorCombinedStatus();
|
||||
emitSimulatorCombinedStatus(oldStatus);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -96,7 +97,7 @@ namespace BlackSimPlugin
|
||||
initWhenConnected();
|
||||
m_simconnectTimerId = startTimer(10);
|
||||
m_simConnected = true;
|
||||
emitSimulatorCombinedStatus();
|
||||
emitSimulatorCombinedStatus(oldStatus);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -352,8 +353,9 @@ namespace BlackSimPlugin
|
||||
|
||||
void CSimulatorFsx::onSimStopped()
|
||||
{
|
||||
int oldStatus = getSimulatorStatus();
|
||||
m_simSimulating = false;
|
||||
emitSimulatorCombinedStatus();
|
||||
emitSimulatorCombinedStatus(oldStatus);
|
||||
}
|
||||
|
||||
void CSimulatorFsx::onSimFrame()
|
||||
|
||||
@@ -84,8 +84,11 @@ namespace BlackSimPlugin
|
||||
case SystemEventPause:
|
||||
{
|
||||
bool p = event->dwData ? true : false;
|
||||
simulatorFsx->m_simPaused = p;
|
||||
simulatorFsx->emitSimulatorCombinedStatus();
|
||||
if (simulatorFsx->m_simPaused != p)
|
||||
{
|
||||
simulatorFsx->m_simPaused = p;
|
||||
simulatorFsx->emitSimulatorCombinedStatus();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -193,6 +193,7 @@ namespace BlackSimPlugin
|
||||
|
||||
bool CSimulatorXPlane::disconnectFrom()
|
||||
{
|
||||
if (!this->isConnected()) { return true; } // avoid emit if already disconnected
|
||||
if (m_traffic)
|
||||
{
|
||||
m_traffic->cleanup();
|
||||
|
||||
Reference in New Issue
Block a user