Ref T180, do not disconnect from dispatch (SimConnectProc) function

This causes a crash in P3Dv4 and has been wrong all the time because it closes itself from within the dispatcher
This commit is contained in:
Klaus Basan
2017-11-02 20:06:10 +01:00
parent 20316fd77d
commit 1018d06f70

View File

@@ -342,7 +342,10 @@ namespace BlackSimPlugin
{
// reset complete state, we are going down
m_simulatingChangedTs = QDateTime::currentMSecsSinceEpoch();
disconnectFrom();
if (m_simConnectTimerId >= 0) { killTimer(m_simConnectTimerId); }
// if called from dispatch function, avoid that SimConnectProc disconnects itself while in SimConnectProc
QTimer::singleShot(0, this, &CSimulatorFsxCommon::disconnectFrom);
}
DWORD CSimulatorFsxCommon::obtainRequestIdSimData()
@@ -761,11 +764,12 @@ namespace BlackSimPlugin
{
// 2nd time, an error / avoid multiple messages
// idea: if it happens once ignore
CLogMessage(this).error("FSX: Dispatch error");
CLogMessage(this).error("FSX/P3D: Dispatch error");
}
else if (m_dispatchErrors > 5)
{
// this normally happens during a FSX crash or shutdown
CLogMessage(this).error("FSX/P3D: Multiple dispatch errors, disconnecting");
this->disconnectFrom();
}
return;