Set timer id to invalid once it got killed

After two consecutive calls to CSimulatorFsx::reset(), the timer was
killed again in the second call. This caused an internal Qt warning,
since the id is unknown after it got killed in the first call.
This commit is contained in:
Roland Winklmeier
2016-11-15 22:16:54 +01:00
committed by Klaus Basan
parent d6deb077a7
commit 2e5176ebcc

View File

@@ -104,7 +104,11 @@ namespace BlackSimPlugin
bool CSimulatorFsx::disconnectFrom()
{
if (!m_simConnected) { return true; }
if (m_simconnectTimerId) { killTimer(m_simconnectTimerId); }
if (m_simconnectTimerId >= 0)
{
killTimer(m_simconnectTimerId);
m_simconnectTimerId = -1;
}
if (m_hSimConnect)
{
SimConnect_Close(m_hSimConnect);
@@ -1038,7 +1042,11 @@ namespace BlackSimPlugin
void CSimulatorFsx::reset()
{
if (m_simconnectTimerId >= 0) { killTimer(m_simconnectTimerId); }
if (m_simconnectTimerId >= 0)
{
killTimer(m_simconnectTimerId);
m_simconnectTimerId = -1;
}
m_simConnected = false;
m_simSimulating = false;
m_syncDeferredCounter = 0;