mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +08:00
Issue #77 Rename
This commit is contained in:
@@ -738,7 +738,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
bool CAfvClient::setInputVolumeDb(double valueDb)
|
bool CAfvClient::setInputVolumeDb(double valueDb)
|
||||||
{
|
{
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
// call in background thread of AFVClient to avoid lock issues
|
// call in background thread of AFVClient to avoid lock issues
|
||||||
QPointer<CAfvClient> myself(this);
|
QPointer<CAfvClient> myself(this);
|
||||||
@@ -986,7 +986,7 @@ namespace BlackCore
|
|||||||
this->stopAudio();
|
this->stopAudio();
|
||||||
this->disconnectFrom();
|
this->disconnectFrom();
|
||||||
this->quitAndWait();
|
this->quitAndWait();
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Needs to be back in current thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Needs to be back in current thread");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAfvClient::initialize()
|
void CAfvClient::initialize()
|
||||||
@@ -1398,7 +1398,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
bool CAfvClient::setOutputVolumeDb(double valueDb)
|
bool CAfvClient::setOutputVolumeDb(double valueDb)
|
||||||
{
|
{
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
// call in background thread of AFVClient to avoid lock issues
|
// call in background thread of AFVClient to avoid lock issues
|
||||||
QPointer<CAfvClient> myself(this);
|
QPointer<CAfvClient> myself(this);
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAirspaceAnalyzer::analyzeAirspace()
|
void CAirspaceAnalyzer::analyzeAirspace()
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(!CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "Expect to run in background thread");
|
Q_ASSERT_X(!CThreadUtils::thisIsMainThread(), Q_FUNC_INFO, "Expect to run in background thread");
|
||||||
Q_ASSERT_X(thread() != qApp->thread(), Q_FUNC_INFO, "Expect to run in background thread affinity");
|
Q_ASSERT_X(thread() != qApp->thread(), Q_FUNC_INFO, "Expect to run in background thread affinity");
|
||||||
|
|
||||||
bool restricted, enabled;
|
bool restricted, enabled;
|
||||||
|
|||||||
@@ -562,7 +562,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAirspaceMonitor::onReceivedAtcBookings(const CAtcStationList &bookedStations)
|
void CAirspaceMonitor::onReceivedAtcBookings(const CAtcStationList &bookedStations)
|
||||||
{
|
{
|
||||||
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
|
Q_ASSERT(CThreadUtils::isInThisThread(this));
|
||||||
if (bookedStations.isEmpty())
|
if (bookedStations.isEmpty())
|
||||||
{
|
{
|
||||||
m_atcStationsBooked.clear();
|
m_atcStationsBooked.clear();
|
||||||
@@ -592,7 +592,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAirspaceMonitor::onReceivedVatsimDataFile()
|
void CAirspaceMonitor::onReceivedVatsimDataFile()
|
||||||
{
|
{
|
||||||
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
|
Q_ASSERT(CThreadUtils::isInThisThread(this));
|
||||||
if (!sApp || sApp->isShuttingDown() || !sApp->getWebDataServices()) { return; }
|
if (!sApp || sApp->isShuttingDown() || !sApp->getWebDataServices()) { return; }
|
||||||
CClientList clients(this->getClients()); // copy
|
CClientList clients(this->getClients()); // copy
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
@@ -731,7 +731,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAirspaceMonitor::onAtcPositionUpdate(const CCallsign &callsign, const CFrequency &frequency, const CCoordinateGeodetic &position, const BlackMisc::PhysicalQuantities::CLength &range)
|
void CAirspaceMonitor::onAtcPositionUpdate(const CCallsign &callsign, const CFrequency &frequency, const CCoordinateGeodetic &position, const BlackMisc::PhysicalQuantities::CLength &range)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "wrong thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "wrong thread");
|
||||||
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
||||||
|
|
||||||
const CAtcStationList stationsWithCallsign = m_atcStationsOnline.findByCallsign(callsign);
|
const CAtcStationList stationsWithCallsign = m_atcStationsOnline.findByCallsign(callsign);
|
||||||
@@ -780,7 +780,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAirspaceMonitor::onAtcControllerDisconnected(const CCallsign &callsign)
|
void CAirspaceMonitor::onAtcControllerDisconnected(const CCallsign &callsign)
|
||||||
{
|
{
|
||||||
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
|
Q_ASSERT(CThreadUtils::isInThisThread(this));
|
||||||
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
||||||
|
|
||||||
this->removeClient(callsign);
|
this->removeClient(callsign);
|
||||||
@@ -798,7 +798,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAirspaceMonitor::onAtisReceived(const CCallsign &callsign, const CInformationMessage &atisMessage)
|
void CAirspaceMonitor::onAtisReceived(const CCallsign &callsign, const CInformationMessage &atisMessage)
|
||||||
{
|
{
|
||||||
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
|
Q_ASSERT(CThreadUtils::isInThisThread(this));
|
||||||
if (!this->isConnectedAndNotShuttingDown() || callsign.isEmpty()) return;
|
if (!this->isConnectedAndNotShuttingDown() || callsign.isEmpty()) return;
|
||||||
const bool changedAtis = m_atcStationsOnline.updateIfMessageChanged(atisMessage, callsign, true);
|
const bool changedAtis = m_atcStationsOnline.updateIfMessageChanged(atisMessage, callsign, true);
|
||||||
|
|
||||||
@@ -811,7 +811,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAirspaceMonitor::onAtisLogoffTimeReceived(const CCallsign &callsign, const QString &zuluTime)
|
void CAirspaceMonitor::onAtisLogoffTimeReceived(const CCallsign &callsign, const QString &zuluTime)
|
||||||
{
|
{
|
||||||
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
|
Q_ASSERT(CThreadUtils::isInThisThread(this));
|
||||||
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
||||||
|
|
||||||
if (zuluTime.length() == 4)
|
if (zuluTime.length() == 4)
|
||||||
@@ -837,7 +837,7 @@ namespace BlackCore
|
|||||||
// ES sends FsInn packets for callsigns such as ACCGER1, which are hard to distinguish
|
// ES sends FsInn packets for callsigns such as ACCGER1, which are hard to distinguish
|
||||||
// 1) checking if they are already in the list checks again ATC position which is safe
|
// 1) checking if they are already in the list checks again ATC position which is safe
|
||||||
// 2) the ATC alike callsign check is guessing
|
// 2) the ATC alike callsign check is guessing
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "not in main thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "not in main thread");
|
||||||
if (!callsign.isValid()) { return; } // aircraft OBS, other invalid callsigns
|
if (!callsign.isValid()) { return; } // aircraft OBS, other invalid callsigns
|
||||||
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
||||||
|
|
||||||
@@ -899,7 +899,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAirspaceMonitor::onIcaoCodesReceived(const CCallsign &callsign, const QString &aircraftIcaoDesignator, const QString &airlineIcaoDesignator, const QString &livery)
|
void CAirspaceMonitor::onIcaoCodesReceived(const CCallsign &callsign, const QString &aircraftIcaoDesignator, const QString &airlineIcaoDesignator, const QString &livery)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "not in main thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "not in main thread");
|
||||||
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
||||||
if (CBuildConfig::isLocalDeveloperDebugBuild()) { BLACK_VERIFY_X(callsign.isValid(), Q_FUNC_INFO, "invalid callsign"); }
|
if (CBuildConfig::isLocalDeveloperDebugBuild()) { BLACK_VERIFY_X(callsign.isValid(), Q_FUNC_INFO, "invalid callsign"); }
|
||||||
if (!callsign.isValid()) { return; }
|
if (!callsign.isValid()) { return; }
|
||||||
@@ -1217,7 +1217,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAirspaceMonitor::onAircraftUpdateReceived(const CAircraftSituation &situation, const CTransponder &transponder)
|
void CAirspaceMonitor::onAircraftUpdateReceived(const CAircraftSituation &situation, const CTransponder &transponder)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Called in different thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Called in different thread");
|
||||||
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
||||||
|
|
||||||
const CCallsign callsign(situation.getCallsign());
|
const CCallsign callsign(situation.getCallsign());
|
||||||
@@ -1267,7 +1267,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAirspaceMonitor::onAircraftInterimUpdateReceived(const CAircraftSituation &situation)
|
void CAirspaceMonitor::onAircraftInterimUpdateReceived(const CAircraftSituation &situation)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Called in different thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Called in different thread");
|
||||||
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
||||||
|
|
||||||
const CCallsign callsign(situation.getCallsign());
|
const CCallsign callsign(situation.getCallsign());
|
||||||
@@ -1329,7 +1329,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAirspaceMonitor::onPilotDisconnected(const CCallsign &callsign)
|
void CAirspaceMonitor::onPilotDisconnected(const CCallsign &callsign)
|
||||||
{
|
{
|
||||||
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
|
Q_ASSERT(CThreadUtils::isInThisThread(this));
|
||||||
|
|
||||||
// in case of inconsistencies I always remove here
|
// in case of inconsistencies I always remove here
|
||||||
this->removeFromAircraftCachesAndLogs(callsign);
|
this->removeFromAircraftCachesAndLogs(callsign);
|
||||||
@@ -1340,7 +1340,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAirspaceMonitor::onFrequencyReceived(const CCallsign &callsign, const CFrequency &frequency)
|
void CAirspaceMonitor::onFrequencyReceived(const CCallsign &callsign, const CFrequency &frequency)
|
||||||
{
|
{
|
||||||
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
|
Q_ASSERT(CThreadUtils::isInThisThread(this));
|
||||||
|
|
||||||
// update
|
// update
|
||||||
const CPropertyIndexVariantMap vm({CSimulatedAircraft::IndexCom1System, CComSystem::IndexActiveFrequency}, CVariant::from(frequency));
|
const CPropertyIndexVariantMap vm({CSimulatedAircraft::IndexCom1System, CComSystem::IndexActiveFrequency}, CVariant::from(frequency));
|
||||||
@@ -1350,7 +1350,7 @@ namespace BlackCore
|
|||||||
void CAirspaceMonitor::onRevBAircraftConfigReceived(const CCallsign &callsign, const QString &config, qint64 currentOffsetMs)
|
void CAirspaceMonitor::onRevBAircraftConfigReceived(const CCallsign &callsign, const QString &config, qint64 currentOffsetMs)
|
||||||
{
|
{
|
||||||
|
|
||||||
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
|
Q_ASSERT(CThreadUtils::isInThisThread(this));
|
||||||
BLACK_AUDIT_X(!callsign.isEmpty(), Q_FUNC_INFO, "Need callsign");
|
BLACK_AUDIT_X(!callsign.isEmpty(), Q_FUNC_INFO, "Need callsign");
|
||||||
if (callsign.isEmpty()) { return; }
|
if (callsign.isEmpty()) { return; }
|
||||||
|
|
||||||
@@ -1410,7 +1410,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAirspaceMonitor::onAircraftConfigReceived(const CCallsign &callsign, const QJsonObject &jsonObject, qint64 currentOffsetMs)
|
void CAirspaceMonitor::onAircraftConfigReceived(const CCallsign &callsign, const QJsonObject &jsonObject, qint64 currentOffsetMs)
|
||||||
{
|
{
|
||||||
Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this));
|
Q_ASSERT(CThreadUtils::isInThisThread(this));
|
||||||
BLACK_AUDIT_X(!callsign.isEmpty(), Q_FUNC_INFO, "Need callsign");
|
BLACK_AUDIT_X(!callsign.isEmpty(), Q_FUNC_INFO, "Need callsign");
|
||||||
if (callsign.isEmpty()) { return; }
|
if (callsign.isEmpty()) { return; }
|
||||||
|
|
||||||
|
|||||||
@@ -1769,7 +1769,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
// should be now in QAM thread
|
// should be now in QAM thread
|
||||||
if (!sApp || sApp->isShuttingDown()) { return; }
|
if (!sApp || sApp->isShuttingDown()) { return; }
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(sApp->m_accessManager), Q_FUNC_INFO, "Wrong thread, must be QAM thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(sApp->m_accessManager), Q_FUNC_INFO, "Wrong thread, must be QAM thread");
|
||||||
this->httpRequestImpl(request, logId, callback, progress, maxRedirects, getPostOrDeleteRequest);
|
this->httpRequestImpl(request, logId, callback, progress, maxRedirects, getPostOrDeleteRequest);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1782,7 +1782,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
// should be now in QAM thread
|
// should be now in QAM thread
|
||||||
if (!sApp || sApp->isShuttingDown()) { return; }
|
if (!sApp || sApp->isShuttingDown()) { return; }
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(sApp->m_accessManager), Q_FUNC_INFO, "Wrong thread, must be QAM thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(sApp->m_accessManager), Q_FUNC_INFO, "Wrong thread, must be QAM thread");
|
||||||
const QNetworkAccessManager::NetworkAccessibility accessibility = m_accessManager->networkAccessible();
|
const QNetworkAccessManager::NetworkAccessibility accessibility = m_accessManager->networkAccessible();
|
||||||
m_networkWatchDog->setNetworkAccessibility(accessibility);
|
m_networkWatchDog->setNetworkAccessibility(accessibility);
|
||||||
});
|
});
|
||||||
@@ -1805,13 +1805,13 @@ namespace BlackCore
|
|||||||
|
|
||||||
QWriteLocker locker(&m_accessManagerLock);
|
QWriteLocker locker(&m_accessManagerLock);
|
||||||
Q_ASSERT_X(m_accessManager->thread() == qApp->thread(), Q_FUNC_INFO, "Network manager supposed to be in main thread");
|
Q_ASSERT_X(m_accessManager->thread() == qApp->thread(), Q_FUNC_INFO, "Network manager supposed to be in main thread");
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(m_accessManager))
|
if (!CThreadUtils::isInThisThread(m_accessManager))
|
||||||
{
|
{
|
||||||
this->httpRequestImplInQAMThread(request, logId, callback, progress, maxRedirects, getPostOrDeleteRequest);
|
this->httpRequestImplInQAMThread(request, logId, callback, progress, maxRedirects, getPostOrDeleteRequest);
|
||||||
return nullptr; // not yet started, will be called again in QAM thread
|
return nullptr; // not yet started, will be called again in QAM thread
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(m_accessManager), Q_FUNC_INFO, "Network manager thread mismatch");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(m_accessManager), Q_FUNC_INFO, "Network manager thread mismatch");
|
||||||
QNetworkRequest copiedRequest = CNetworkUtils::getSwiftNetworkRequest(request, this->getApplicationNameAndVersion());
|
QNetworkRequest copiedRequest = CNetworkUtils::getSwiftNetworkRequest(request, this->getApplicationNameAndVersion());
|
||||||
|
|
||||||
// If URL is one of the shared URLs, add swift client SSL certificate to request
|
// If URL is one of the shared URLs, add swift client SSL certificate to request
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ namespace BlackCore
|
|||||||
if (m_voiceClient)
|
if (m_voiceClient)
|
||||||
{
|
{
|
||||||
m_voiceClient->gracefulShutdown();
|
m_voiceClient->gracefulShutdown();
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(m_voiceClient), Q_FUNC_INFO, "Needs to be back in current thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(m_voiceClient), Q_FUNC_INFO, "Needs to be back in current thread");
|
||||||
m_voiceClient->deleteLater();
|
m_voiceClient->deleteLater();
|
||||||
m_voiceClient = nullptr;
|
m_voiceClient = nullptr;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|||||||
@@ -461,7 +461,7 @@ namespace BlackCore
|
|||||||
Q_ASSERT(this->getIContextApplication());
|
Q_ASSERT(this->getIContextApplication());
|
||||||
Q_ASSERT(this->getIContextApplication()->isUsingImplementingObject());
|
Q_ASSERT(this->getIContextApplication()->isUsingImplementingObject());
|
||||||
Q_ASSERT(!simulatorPluginInfo.isUnspecified());
|
Q_ASSERT(!simulatorPluginInfo.isUnspecified());
|
||||||
Q_ASSERT(CThreadUtils::isCurrentThreadApplicationThread()); // only run in main thread
|
Q_ASSERT(CThreadUtils::thisIsMainThread()); // only run in main thread
|
||||||
|
|
||||||
// Is a plugin already loaded?
|
// Is a plugin already loaded?
|
||||||
if (!m_simulatorPlugin.first.isUnspecified())
|
if (!m_simulatorPlugin.first.isUnspecified())
|
||||||
|
|||||||
@@ -619,7 +619,7 @@ namespace BlackCore
|
|||||||
const bool overrideNewerOnly = true;
|
const bool overrideNewerOnly = true;
|
||||||
entities = this->maskBySupportedEntities(entities);
|
entities = this->maskBySupportedEntities(entities);
|
||||||
|
|
||||||
if (inBackground || !CThreadUtils::isCurrentThreadObjectThread(this))
|
if (inBackground || !CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
const bool s = this->readFromJsonFilesInBackground(CDirectoryUtils::staticDbFilesDirectory(), entities, overrideNewerOnly);
|
const bool s = this->readFromJsonFilesInBackground(CDirectoryUtils::staticDbFilesDirectory(), entities, overrideNewerOnly);
|
||||||
return s ?
|
return s ?
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ namespace BlackCore
|
|||||||
if (m_disableNetworkCheck) { return; } // ignore with disabled check
|
if (m_disableNetworkCheck) { return; } // ignore with disabled check
|
||||||
|
|
||||||
// shift to thread
|
// shift to thread
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
QPointer<CNetworkWatchdog> myself(this);
|
QPointer<CNetworkWatchdog> myself(this);
|
||||||
QTimer::singleShot(0, this, [ = ]
|
QTimer::singleShot(0, this, [ = ]
|
||||||
@@ -315,7 +315,7 @@ namespace BlackCore
|
|||||||
nw->close();
|
nw->close();
|
||||||
|
|
||||||
if (!sApp || sApp->isShuttingDown()) { return; }
|
if (!sApp || sApp->isShuttingDown()) { return; }
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Wrong thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Wrong thread");
|
||||||
|
|
||||||
m_lastClientPingSuccess = ok;
|
m_lastClientPingSuccess = ok;
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CFSDClient::connectToServer()
|
void CFSDClient::connectToServer()
|
||||||
{
|
{
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod(this, [ = ]
|
QMetaObject::invokeMethod(this, [ = ]
|
||||||
{
|
{
|
||||||
@@ -265,7 +265,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CFSDClient::disconnectFromServer()
|
void CFSDClient::disconnectFromServer()
|
||||||
{
|
{
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod(this, [ = ]
|
QMetaObject::invokeMethod(this, [ = ]
|
||||||
{
|
{
|
||||||
@@ -441,7 +441,7 @@ namespace BlackCore
|
|||||||
void CFSDClient::sendClientQuery(ClientQueryType queryType, const CCallsign &receiver, const QStringList &queryData)
|
void CFSDClient::sendClientQuery(ClientQueryType queryType, const CCallsign &receiver, const QStringList &queryData)
|
||||||
{
|
{
|
||||||
if (queryType == ClientQueryType::Unknown) { return; }
|
if (queryType == ClientQueryType::Unknown) { return; }
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod(this, [ = ]
|
QMetaObject::invokeMethod(this, [ = ]
|
||||||
{
|
{
|
||||||
@@ -514,7 +514,7 @@ namespace BlackCore
|
|||||||
void CFSDClient::sendTextMessages(const CTextMessageList &messages)
|
void CFSDClient::sendTextMessages(const CTextMessageList &messages)
|
||||||
{
|
{
|
||||||
if (messages.isEmpty()) { return; }
|
if (messages.isEmpty()) { return; }
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod(this, [ = ]
|
QMetaObject::invokeMethod(this, [ = ]
|
||||||
{
|
{
|
||||||
@@ -565,7 +565,7 @@ namespace BlackCore
|
|||||||
void CFSDClient::sendTextMessage(TextMessageGroups receiverGroup, const QString &message)
|
void CFSDClient::sendTextMessage(TextMessageGroups receiverGroup, const QString &message)
|
||||||
{
|
{
|
||||||
if (message.isEmpty()) { return; }
|
if (message.isEmpty()) { return; }
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod(this, [ = ]
|
QMetaObject::invokeMethod(this, [ = ]
|
||||||
{
|
{
|
||||||
@@ -614,7 +614,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CFSDClient::sendFlightPlan(const CFlightPlan &flightPlan)
|
void CFSDClient::sendFlightPlan(const CFlightPlan &flightPlan)
|
||||||
{
|
{
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod(this, [ = ]
|
QMetaObject::invokeMethod(this, [ = ]
|
||||||
{
|
{
|
||||||
@@ -671,7 +671,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CFSDClient::sendPlaneInfoRequest(const CCallsign &receiver)
|
void CFSDClient::sendPlaneInfoRequest(const CCallsign &receiver)
|
||||||
{
|
{
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod(this, [ = ]
|
QMetaObject::invokeMethod(this, [ = ]
|
||||||
{
|
{
|
||||||
@@ -687,7 +687,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CFSDClient::sendPlaneInfoRequestFsinn(const CCallsign &callsign)
|
void CFSDClient::sendPlaneInfoRequestFsinn(const CCallsign &callsign)
|
||||||
{
|
{
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod(this, [ = ]
|
QMetaObject::invokeMethod(this, [ = ]
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ namespace BlackCore
|
|||||||
void ISimulator::safeKillTimer()
|
void ISimulator::safeKillTimer()
|
||||||
{
|
{
|
||||||
if (m_timerId < 0) { return; }
|
if (m_timerId < 0) { return; }
|
||||||
BLACK_AUDIT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Try to kill timer from another thread");
|
BLACK_AUDIT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Try to kill timer from another thread");
|
||||||
this->killTimer(m_timerId);
|
this->killTimer(m_timerId);
|
||||||
m_timerId = -1;
|
m_timerId = -1;
|
||||||
}
|
}
|
||||||
@@ -816,7 +816,7 @@ namespace BlackCore
|
|||||||
// when changing back from restricted->unrestricted an one time update is required
|
// when changing back from restricted->unrestricted an one time update is required
|
||||||
if (!snapshot.isRestricted() && !snapshot.isRestrictionChanged()) { return; }
|
if (!snapshot.isRestricted() && !snapshot.isRestrictionChanged()) { return; }
|
||||||
|
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Needs to run in object thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Needs to run in object thread");
|
||||||
Q_ASSERT_X(snapshot.generatingThreadName() != QThread::currentThread()->objectName(), Q_FUNC_INFO, "Expect snapshot from background thread");
|
Q_ASSERT_X(snapshot.generatingThreadName() != QThread::currentThread()->objectName(), Q_FUNC_INFO, "Expect snapshot from background thread");
|
||||||
|
|
||||||
// restricted snapshot values?
|
// restricted snapshot values?
|
||||||
@@ -1464,7 +1464,7 @@ namespace BlackCore
|
|||||||
void ISimulatorListener::start()
|
void ISimulatorListener::start()
|
||||||
{
|
{
|
||||||
if (m_isRunning) { return; }
|
if (m_isRunning) { return; }
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
// call in correct thread
|
// call in correct thread
|
||||||
QPointer<ISimulatorListener> myself(this);
|
QPointer<ISimulatorListener> myself(this);
|
||||||
@@ -1479,7 +1479,7 @@ namespace BlackCore
|
|||||||
void ISimulatorListener::stop()
|
void ISimulatorListener::stop()
|
||||||
{
|
{
|
||||||
if (!m_isRunning) { return; }
|
if (!m_isRunning) { return; }
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
// call in correct thread
|
// call in correct thread
|
||||||
QPointer<ISimulatorListener> myself(this);
|
QPointer<ISimulatorListener> myself(this);
|
||||||
@@ -1494,7 +1494,7 @@ namespace BlackCore
|
|||||||
void ISimulatorListener::check()
|
void ISimulatorListener::check()
|
||||||
{
|
{
|
||||||
if (!m_isRunning) { return; }
|
if (!m_isRunning) { return; }
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
// call in correct thread
|
// call in correct thread
|
||||||
QPointer<ISimulatorListener> myself(this);
|
QPointer<ISimulatorListener> myself(this);
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ namespace BlackCore
|
|||||||
if (!this->isEnabled()) { return false; }
|
if (!this->isEnabled()) { return false; }
|
||||||
|
|
||||||
// MS 2019-02-23 isAbandoned() check only makes sense when called by worker thread (T541)
|
// MS 2019-02-23 isAbandoned() check only makes sense when called by worker thread (T541)
|
||||||
if (CThreadUtils::isCurrentThreadObjectThread(this) && this->isAbandoned()) { return false; }
|
if (CThreadUtils::isInThisThread(this) && this->isAbandoned()) { return false; }
|
||||||
|
|
||||||
if (!m_unitTest && (!sApp || sApp->isShuttingDown())) { return false; }
|
if (!m_unitTest && (!sApp || sApp->isShuttingDown())) { return false; }
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1012,7 +1012,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CWebDataServices::initReaders(CWebReaderFlags::WebReader readersNeeded, CEntityFlags::Entity entities)
|
void CWebDataServices::initReaders(CWebReaderFlags::WebReader readersNeeded, CEntityFlags::Entity entities)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "shall run in main application thread");
|
Q_ASSERT_X(CThreadUtils::thisIsMainThread(), Q_FUNC_INFO, "shall run in main application thread");
|
||||||
|
|
||||||
//
|
//
|
||||||
// ---- "metadata" reader, 1 will trigger read directly during init
|
// ---- "metadata" reader, 1 will trigger read directly during init
|
||||||
@@ -1173,7 +1173,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
// run in correct thread
|
// run in correct thread
|
||||||
if (m_shuttingDown) { return; }
|
if (m_shuttingDown) { return; }
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
const QPointer<CWebDataServices> myself(this);
|
const QPointer<CWebDataServices> myself(this);
|
||||||
QTimer::singleShot(0, this, [ = ]
|
QTimer::singleShot(0, this, [ = ]
|
||||||
@@ -1215,7 +1215,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
// run in correct thread
|
// run in correct thread
|
||||||
if (m_shuttingDown) { return; }
|
if (m_shuttingDown) { return; }
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
const QPointer<CWebDataServices> myself(this);
|
const QPointer<CWebDataServices> myself(this);
|
||||||
QTimer::singleShot(0, this, [ = ]
|
QTimer::singleShot(0, this, [ = ]
|
||||||
@@ -1582,7 +1582,7 @@ namespace BlackCore
|
|||||||
if (m_icaoDataReader)
|
if (m_icaoDataReader)
|
||||||
{
|
{
|
||||||
// force update to background reading if reader is already in another thread
|
// force update to background reading if reader is already in another thread
|
||||||
bool ib = inBackground || !CThreadUtils::isCurrentThreadObjectThread(m_icaoDataReader);
|
bool ib = inBackground || !CThreadUtils::isInThisThread(m_icaoDataReader);
|
||||||
if (ib)
|
if (ib)
|
||||||
{
|
{
|
||||||
CLogMessage(this).info(u"Reading from disk in background: %1") << m_icaoDataReader->getSupportedEntitiesAsString();
|
CLogMessage(this).info(u"Reading from disk in background: %1") << m_icaoDataReader->getSupportedEntitiesAsString();
|
||||||
@@ -1600,7 +1600,7 @@ namespace BlackCore
|
|||||||
if (m_modelDataReader)
|
if (m_modelDataReader)
|
||||||
{
|
{
|
||||||
// force update to background reading if reader is already in another thread
|
// force update to background reading if reader is already in another thread
|
||||||
bool ib = inBackground || !CThreadUtils::isCurrentThreadObjectThread(m_modelDataReader);
|
bool ib = inBackground || !CThreadUtils::isInThisThread(m_modelDataReader);
|
||||||
if (ib)
|
if (ib)
|
||||||
{
|
{
|
||||||
CLogMessage(this).info(u"Reading from disk in background: %1") << m_modelDataReader->getSupportedEntitiesAsString();
|
CLogMessage(this).info(u"Reading from disk in background: %1") << m_modelDataReader->getSupportedEntitiesAsString();
|
||||||
@@ -1618,7 +1618,7 @@ namespace BlackCore
|
|||||||
if (m_airportDataReader)
|
if (m_airportDataReader)
|
||||||
{
|
{
|
||||||
// force update to background reading if reader is already in another thread
|
// force update to background reading if reader is already in another thread
|
||||||
bool ib = inBackground || !CThreadUtils::isCurrentThreadObjectThread(m_airportDataReader);
|
bool ib = inBackground || !CThreadUtils::isInThisThread(m_airportDataReader);
|
||||||
if (ib)
|
if (ib)
|
||||||
{
|
{
|
||||||
CLogMessage(this).info(u"Reading from disk in background: %1") << m_airportDataReader->getSupportedEntitiesAsString();
|
CLogMessage(this).info(u"Reading from disk in background: %1") << m_airportDataReader->getSupportedEntitiesAsString();
|
||||||
|
|||||||
@@ -1384,7 +1384,7 @@ namespace BlackGui
|
|||||||
// changing widget style is slow, so I try to prevent setting it when nothing changed
|
// changing widget style is slow, so I try to prevent setting it when nothing changed
|
||||||
const QString widgetStyle = m_guiSettings.get().getWidgetStyle();
|
const QString widgetStyle = m_guiSettings.get().getWidgetStyle();
|
||||||
const QString currentWidgetStyle(this->getWidgetStyle());
|
const QString currentWidgetStyle(this->getWidgetStyle());
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "Wrong thread");
|
Q_ASSERT_X(CThreadUtils::thisIsMainThread(), Q_FUNC_INFO, "Wrong thread");
|
||||||
if (!stringCompare(widgetStyle, currentWidgetStyle, Qt::CaseInsensitive))
|
if (!stringCompare(widgetStyle, currentWidgetStyle, Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
const QStringList availableStyles = QStyleFactory::keys();
|
const QStringList availableStyles = QStyleFactory::keys();
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace BlackGui
|
|||||||
m_pendingIds.clear();
|
m_pendingIds.clear();
|
||||||
if (m_timerId != -1)
|
if (m_timerId != -1)
|
||||||
{
|
{
|
||||||
BLACK_AUDIT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Try to kill timer from another thread");
|
BLACK_AUDIT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Try to kill timer from another thread");
|
||||||
this->killTimer(m_timerId);
|
this->killTimer(m_timerId);
|
||||||
}
|
}
|
||||||
m_timerId = -1;
|
m_timerId = -1;
|
||||||
@@ -106,7 +106,7 @@ namespace BlackGui
|
|||||||
m_delayMs = delay;
|
m_delayMs = delay;
|
||||||
if (m_timerId != -1)
|
if (m_timerId != -1)
|
||||||
{
|
{
|
||||||
BLACK_AUDIT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Try to kill timer from another thread");
|
BLACK_AUDIT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Try to kill timer from another thread");
|
||||||
this->killTimer(m_timerId);
|
this->killTimer(m_timerId);
|
||||||
}
|
}
|
||||||
m_timerId = this->startTimer(m_delayMs);
|
m_timerId = this->startTimer(m_delayMs);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CAircraftCategoryTreeModel::updateContainer(const CAircraftCategoryList &categories)
|
void CAircraftCategoryTreeModel::updateContainer(const CAircraftCategoryList &categories)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Wrong thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Wrong thread");
|
||||||
|
|
||||||
this->clear();
|
this->clear();
|
||||||
if (categories.isEmpty()) { return; }
|
if (categories.isEmpty()) { return; }
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
// run in page thread
|
// run in page thread
|
||||||
//! \todo KB 2018-01 is this OK or should it go to CValuePage::setValuesFromCache?
|
//! \todo KB 2018-01 is this OK or should it go to CValuePage::setValuesFromCache?
|
||||||
if (CThreadUtils::isCurrentThreadObjectThread(this->m_page)) { queue->setQueuedValueFromCache(key); }
|
if (CThreadUtils::isInThisThread(this->m_page)) { queue->setQueuedValueFromCache(key); }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QPointer<QObject> myself(queue);
|
QPointer<QObject> myself(queue);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
void CDigestSignal::inputSignal()
|
void CDigestSignal::inputSignal()
|
||||||
{
|
{
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
// call in correct thread
|
// call in correct thread
|
||||||
const QPointer<CDigestSignal> myself(this);
|
const QPointer<CDigestSignal> myself(this);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace BlackMisc
|
|||||||
Q_UNUSED(event)
|
Q_UNUSED(event)
|
||||||
if (m_timerId >= 0)
|
if (m_timerId >= 0)
|
||||||
{
|
{
|
||||||
BLACK_AUDIT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Try to kill timer from another thread");
|
BLACK_AUDIT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Try to kill timer from another thread");
|
||||||
this->killTimer(m_timerId);
|
this->killTimer(m_timerId);
|
||||||
}
|
}
|
||||||
m_timerId = -1;
|
m_timerId = -1;
|
||||||
|
|||||||
@@ -1340,7 +1340,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
//! \fixme KB 20170701 noticed the "cache" is not threadsafe. However, there has never be an issue so far. Added thread assert.
|
//! \fixme KB 20170701 noticed the "cache" is not threadsafe. However, there has never be an issue so far. Added thread assert.
|
||||||
Q_ASSERT_X(!relativeFileName.isEmpty(), Q_FUNC_INFO, "missing filename");
|
Q_ASSERT_X(!relativeFileName.isEmpty(), Q_FUNC_INFO, "missing filename");
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "not thread safe");
|
Q_ASSERT_X(CThreadUtils::thisIsMainThread(), Q_FUNC_INFO, "not thread safe");
|
||||||
|
|
||||||
fullFilePath = CFileUtils::appendFilePaths(CDirectoryUtils::imagesDirectory(), relativeFileName);
|
fullFilePath = CFileUtils::appendFilePaths(CDirectoryUtils::imagesDirectory(), relativeFileName);
|
||||||
if (!getResourceFileCache().contains(relativeFileName))
|
if (!getResourceFileCache().contains(relativeFileName))
|
||||||
|
|||||||
@@ -443,7 +443,7 @@ namespace BlackMisc
|
|||||||
static CCentralMultiSimulatorModelCachesProvider &modelCachesInstance()
|
static CCentralMultiSimulatorModelCachesProvider &modelCachesInstance()
|
||||||
{
|
{
|
||||||
static CCentralMultiSimulatorModelCachesProvider c("Central model caches provider");
|
static CCentralMultiSimulatorModelCachesProvider c("Central model caches provider");
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(&c), Q_FUNC_INFO, "Wrong thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(&c), Q_FUNC_INFO, "Wrong thread");
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,7 +496,7 @@ namespace BlackMisc
|
|||||||
static CCentralMultiSimulatorModelSetCachesProvider &modelCachesInstance()
|
static CCentralMultiSimulatorModelSetCachesProvider &modelCachesInstance()
|
||||||
{
|
{
|
||||||
static CCentralMultiSimulatorModelSetCachesProvider c("Central model sets provider");
|
static CCentralMultiSimulatorModelSetCachesProvider c("Central model sets provider");
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(&c), Q_FUNC_INFO, "Wrong thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(&c), Q_FUNC_INFO, "Wrong thread");
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,12 +19,12 @@
|
|||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
{
|
{
|
||||||
bool CThreadUtils::isCurrentThreadObjectThread(const QObject *toBeTested)
|
bool CThreadUtils::isInThisThread(const QObject *toBeTested)
|
||||||
{
|
{
|
||||||
return QThread::currentThread() == toBeTested->thread();
|
return QThread::currentThread() == toBeTested->thread();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CThreadUtils::isCurrentThreadApplicationThread()
|
bool CThreadUtils::thisIsMainThread()
|
||||||
{
|
{
|
||||||
return qApp && QThread::currentThread() == qApp->thread();
|
return qApp && QThread::currentThread() == qApp->thread();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,10 +27,14 @@ namespace BlackMisc
|
|||||||
CThreadUtils() = delete;
|
CThreadUtils() = delete;
|
||||||
|
|
||||||
//! Is the current thread the object's thread?
|
//! Is the current thread the object's thread?
|
||||||
static bool isCurrentThreadObjectThread(const QObject *toBeTested);
|
//! \deprecated
|
||||||
|
//! \todo Refactor to inline method
|
||||||
|
static bool isInThisThread(const QObject *toBeTested);
|
||||||
|
|
||||||
//! Is the current thread the application thread?
|
//! Is the current thread the application thread?
|
||||||
static bool isCurrentThreadApplicationThread();
|
//! \deprecated
|
||||||
|
//! \todo Refactor to inline method
|
||||||
|
static bool thisIsMainThread();
|
||||||
|
|
||||||
//! Info about current thread, for debug messages
|
//! Info about current thread, for debug messages
|
||||||
static QString currentThreadInfo();
|
static QString currentThreadInfo();
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ namespace BlackMisc
|
|||||||
if (hasStarted()) { return; }
|
if (hasStarted()) { return; }
|
||||||
|
|
||||||
// avoid message "QObject: Cannot create children for a parent that is in a different thread"
|
// avoid message "QObject: Cannot create children for a parent that is in a different thread"
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(m_owner), Q_FUNC_INFO, "Needs to be started in owner thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(m_owner), Q_FUNC_INFO, "Needs to be started in owner thread");
|
||||||
emit this->aboutToStart();
|
emit this->aboutToStart();
|
||||||
setStarted();
|
setStarted();
|
||||||
auto *thread = new CRegularThread(m_owner);
|
auto *thread = new CRegularThread(m_owner);
|
||||||
@@ -203,7 +203,7 @@ namespace BlackMisc
|
|||||||
if (this->thread() == m_owner->thread()) { return; }
|
if (this->thread() == m_owner->thread()) { return; }
|
||||||
|
|
||||||
// called by own thread, will deadlock, return
|
// called by own thread, will deadlock, return
|
||||||
if (CThreadUtils::isCurrentThreadObjectThread(this)) { return; }
|
if (CThreadUtils::isInThisThread(this)) { return; }
|
||||||
|
|
||||||
QThread *workerThread = thread(); // must be before quit()
|
QThread *workerThread = thread(); // must be before quit()
|
||||||
this->quit();
|
this->quit();
|
||||||
@@ -224,7 +224,7 @@ namespace BlackMisc
|
|||||||
void CContinuousWorker::startUpdating(int updateTimeSecs)
|
void CContinuousWorker::startUpdating(int updateTimeSecs)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(this->hasStarted(), Q_FUNC_INFO, "Worker not yet started");
|
Q_ASSERT_X(this->hasStarted(), Q_FUNC_INFO, "Worker not yet started");
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
// shift in correct thread
|
// shift in correct thread
|
||||||
QPointer<CContinuousWorker> myself(this);
|
QPointer<CContinuousWorker> myself(this);
|
||||||
@@ -254,7 +254,7 @@ namespace BlackMisc
|
|||||||
if (!m_updateTimer.isActive()) { return; }
|
if (!m_updateTimer.isActive()) { return; }
|
||||||
|
|
||||||
// avoid "Timers cannot be stopped from another thread"
|
// avoid "Timers cannot be stopped from another thread"
|
||||||
if (CThreadUtils::isCurrentThreadObjectThread(&m_updateTimer))
|
if (CThreadUtils::isInThisThread(&m_updateTimer))
|
||||||
{
|
{
|
||||||
m_updateTimer.stop();
|
m_updateTimer.stop();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -501,7 +501,7 @@ namespace BlackSimPlugin
|
|||||||
if (this->isShuttingDownOrDisconnected()) { return false; }
|
if (this->isShuttingDownOrDisconnected()) { return false; }
|
||||||
|
|
||||||
// entry checks
|
// entry checks
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "thread");
|
||||||
Q_ASSERT_X(!newRemoteAircraft.getCallsign().isEmpty(), Q_FUNC_INFO, "empty callsign");
|
Q_ASSERT_X(!newRemoteAircraft.getCallsign().isEmpty(), Q_FUNC_INFO, "empty callsign");
|
||||||
Q_ASSERT_X(newRemoteAircraft.hasModelString(), Q_FUNC_INFO, "missing model string");
|
Q_ASSERT_X(newRemoteAircraft.hasModelString(), Q_FUNC_INFO, "missing model string");
|
||||||
|
|
||||||
@@ -557,7 +557,7 @@ namespace BlackSimPlugin
|
|||||||
if (this->isShuttingDownOrDisconnected()) { return false; }
|
if (this->isShuttingDownOrDisconnected()) { return false; }
|
||||||
|
|
||||||
// only remove from sim
|
// only remove from sim
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "wrong thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "wrong thread");
|
||||||
if (callsign.isEmpty()) { return false; } // can happen if an object is not an aircraft
|
if (callsign.isEmpty()) { return false; } // can happen if an object is not an aircraft
|
||||||
|
|
||||||
// really remove from simulator
|
// really remove from simulator
|
||||||
@@ -622,7 +622,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
void CSimulatorFlightgear::updateRemoteAircraft()
|
void CSimulatorFlightgear::updateRemoteAircraft()
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "thread");
|
||||||
|
|
||||||
const int remoteAircraftNo = this->getAircraftInRangeCount();
|
const int remoteAircraftNo = this->getAircraftInRangeCount();
|
||||||
if (remoteAircraftNo < 1) { return; }
|
if (remoteAircraftNo < 1) { return; }
|
||||||
@@ -1042,7 +1042,7 @@ namespace BlackSimPlugin
|
|||||||
void CSimulatorFlightgearListener::checkConnection()
|
void CSimulatorFlightgearListener::checkConnection()
|
||||||
{
|
{
|
||||||
if (this->isShuttingDown()) { return; }
|
if (this->isShuttingDown()) { return; }
|
||||||
Q_ASSERT_X(!CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "Expect to run in background");
|
Q_ASSERT_X(!CThreadUtils::thisIsMainThread(), Q_FUNC_INFO, "Expect to run in background");
|
||||||
|
|
||||||
QString dbusAddress = m_fgSswiftBusServerSetting.getThreadLocal();
|
QString dbusAddress = m_fgSswiftBusServerSetting.getThreadLocal();
|
||||||
if (CDBusServer::isSessionOrSystemAddress(dbusAddress))
|
if (CDBusServer::isSessionOrSystemAddress(dbusAddress))
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ namespace BlackSimPlugin
|
|||||||
if (this->isShuttingDownOrDisconnected()) { return; }
|
if (this->isShuttingDownOrDisconnected()) { return; }
|
||||||
if (weatherGrid.isEmpty()) { return; }
|
if (weatherGrid.isEmpty()) { return; }
|
||||||
|
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread");
|
BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread");
|
||||||
QPointer<CSimulatorFs9> myself(this);
|
QPointer<CSimulatorFs9> myself(this);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CFsuipc::open(bool force)
|
bool CFsuipc::open(bool force)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
||||||
DWORD dwResult;
|
DWORD dwResult;
|
||||||
m_lastErrorMessage = "";
|
m_lastErrorMessage = "";
|
||||||
m_lastErrorIndex = 0;
|
m_lastErrorIndex = 0;
|
||||||
@@ -119,7 +119,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
void CFsuipc::close()
|
void CFsuipc::close()
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
||||||
if (m_opened)
|
if (m_opened)
|
||||||
{
|
{
|
||||||
CLogMessage(this).info(u"Closing FSUIPC: %1") << m_fsuipcVersion;
|
CLogMessage(this).info(u"Closing FSUIPC: %1") << m_fsuipcVersion;
|
||||||
@@ -150,7 +150,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CFsuipc::write(const CSimulatedAircraft &aircraft)
|
bool CFsuipc::write(const CSimulatedAircraft &aircraft)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
||||||
if (!this->isOpened()) { return false; }
|
if (!this->isOpened()) { return false; }
|
||||||
|
|
||||||
quint16 com1ActiveRaw = static_cast<quint16>(aircraft.getCom1System().getFrequencyActive().value(CFrequencyUnit::MHz()) * 100);
|
quint16 com1ActiveRaw = static_cast<quint16>(aircraft.getCom1System().getFrequencyActive().value(CFrequencyUnit::MHz()) * 100);
|
||||||
@@ -180,7 +180,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CFsuipc::write(const CTransponder &xpdr)
|
bool CFsuipc::write(const CTransponder &xpdr)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
||||||
if (!this->isOpened()) { return false; }
|
if (!this->isOpened()) { return false; }
|
||||||
|
|
||||||
// should be the same as writing via SimConnect data area
|
// should be the same as writing via SimConnect data area
|
||||||
@@ -196,7 +196,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CFsuipc::write(const CWeatherGrid &weatherGrid)
|
bool CFsuipc::write(const CWeatherGrid &weatherGrid)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
||||||
if (!this->isOpened()) { return false; }
|
if (!this->isOpened()) { return false; }
|
||||||
|
|
||||||
if (weatherGrid.isEmpty()) { return false; }
|
if (weatherGrid.isEmpty()) { return false; }
|
||||||
@@ -333,7 +333,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CFsuipc::setSimulatorTime(int hour, int minute)
|
bool CFsuipc::setSimulatorTime(int hour, int minute)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
||||||
if (!this->isOpened()) { return false; }
|
if (!this->isOpened()) { return false; }
|
||||||
|
|
||||||
// should be the same as writing via SimConnect data area
|
// should be the same as writing via SimConnect data area
|
||||||
@@ -355,7 +355,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CFsuipc::read(CSimulatedAircraft &aircraft, bool cockpit, bool situation, bool aircraftParts)
|
bool CFsuipc::read(CSimulatedAircraft &aircraft, bool cockpit, bool situation, bool aircraftParts)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "Open not threadsafe");
|
||||||
DWORD dwResult = 0;
|
DWORD dwResult = 0;
|
||||||
char localFsTimeRaw[3];
|
char localFsTimeRaw[3];
|
||||||
char modelNameRaw[256];
|
char modelNameRaw[256];
|
||||||
|
|||||||
@@ -1513,7 +1513,7 @@ namespace BlackSimPlugin
|
|||||||
const bool probe = newRemoteAircraft.isTerrainProbe();
|
const bool probe = newRemoteAircraft.isTerrainProbe();
|
||||||
|
|
||||||
// entry checks
|
// entry checks
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "thread");
|
||||||
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "empty callsign");
|
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "empty callsign");
|
||||||
Q_ASSERT_X(newRemoteAircraft.hasModelString(), Q_FUNC_INFO, "missing model string");
|
Q_ASSERT_X(newRemoteAircraft.hasModelString(), Q_FUNC_INFO, "missing model string");
|
||||||
|
|
||||||
@@ -1701,7 +1701,7 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
if (coordinate.isNull()) { return false; }
|
if (coordinate.isNull()) { return false; }
|
||||||
if (!this->isUsingFsxTerrainProbe()) { return false; }
|
if (!this->isUsingFsxTerrainProbe()) { return false; }
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "thread");
|
||||||
|
|
||||||
// static const QString modelString("OrcaWhale");
|
// static const QString modelString("OrcaWhale");
|
||||||
// static const QString modelString("Water Drop"); // not working on P3Dx86/FSX, no requests on that id possible
|
// static const QString modelString("Water Drop"); // not working on P3Dx86/FSX, no requests on that id possible
|
||||||
@@ -1745,7 +1745,7 @@ namespace BlackSimPlugin
|
|||||||
bool CSimulatorFsxCommon::physicallyRemoveRemoteAircraft(const CCallsign &callsign)
|
bool CSimulatorFsxCommon::physicallyRemoveRemoteAircraft(const CCallsign &callsign)
|
||||||
{
|
{
|
||||||
// only remove from sim
|
// only remove from sim
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "wrong thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "wrong thread");
|
||||||
if (callsign.isEmpty()) { return false; } // can happen if an object is not an aircraft
|
if (callsign.isEmpty()) { return false; } // can happen if an object is not an aircraft
|
||||||
|
|
||||||
// clean up anyway
|
// clean up anyway
|
||||||
@@ -1939,7 +1939,7 @@ namespace BlackSimPlugin
|
|||||||
void CSimulatorFsxCommon::updateRemoteAircraft()
|
void CSimulatorFsxCommon::updateRemoteAircraft()
|
||||||
{
|
{
|
||||||
static_assert(sizeof(DataDefinitionRemoteAircraftPartsWithoutLights) == sizeof(double) * 10, "DataDefinitionRemoteAircraftPartsWithoutLights has an incorrect size.");
|
static_assert(sizeof(DataDefinitionRemoteAircraftPartsWithoutLights) == sizeof(double) * 10, "DataDefinitionRemoteAircraftPartsWithoutLights has an incorrect size.");
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "thread");
|
||||||
|
|
||||||
// Freeze interpolation while paused
|
// Freeze interpolation while paused
|
||||||
if (this->isPaused() && m_pausedSimFreezesInterpolation) { return; }
|
if (this->isPaused() && m_pausedSimFreezesInterpolation) { return; }
|
||||||
@@ -2395,7 +2395,7 @@ namespace BlackSimPlugin
|
|||||||
if (this->isShuttingDownOrDisconnected()) { return; }
|
if (this->isShuttingDownOrDisconnected()) { return; }
|
||||||
if (weatherGrid.isEmpty()) { return; }
|
if (weatherGrid.isEmpty()) { return; }
|
||||||
|
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread");
|
BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread");
|
||||||
QPointer<CSimulatorFsxCommon> myself(this);
|
QPointer<CSimulatorFsxCommon> myself(this);
|
||||||
@@ -2841,7 +2841,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
void CSimulatorFsxCommonListener::checkConnection()
|
void CSimulatorFsxCommonListener::checkConnection()
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(!CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "Expect to run in background");
|
Q_ASSERT_X(!CThreadUtils::thisIsMainThread(), Q_FUNC_INFO, "Expect to run in background");
|
||||||
|
|
||||||
// check before we access the sim. connection
|
// check before we access the sim. connection
|
||||||
if (this->isShuttingDown() || this->thread()->isInterruptionRequested())
|
if (this->isShuttingDown() || this->thread()->isInterruptionRequested())
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ namespace BlackSimPlugin
|
|||||||
if (this->isShuttingDown()) { return false; }
|
if (this->isShuttingDown()) { return false; }
|
||||||
if (!this->isConnected()) { return false; }
|
if (!this->isConnected()) { return false; }
|
||||||
|
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "thread");
|
||||||
const bool hasHeight = reference.hasMSLGeodeticHeight();
|
const bool hasHeight = reference.hasMSLGeodeticHeight();
|
||||||
const double latDeg = reference.latitude().value(CAngleUnit::deg());
|
const double latDeg = reference.latitude().value(CAngleUnit::deg());
|
||||||
const double lngDeg = reference.longitude().value(CAngleUnit::deg());
|
const double lngDeg = reference.longitude().value(CAngleUnit::deg());
|
||||||
|
|||||||
@@ -765,7 +765,7 @@ namespace BlackSimPlugin
|
|||||||
if (this->isShuttingDownOrDisconnected()) { return false; }
|
if (this->isShuttingDownOrDisconnected()) { return false; }
|
||||||
|
|
||||||
// entry checks
|
// entry checks
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "thread");
|
||||||
Q_ASSERT_X(!newRemoteAircraft.getCallsign().isEmpty(), Q_FUNC_INFO, "empty callsign");
|
Q_ASSERT_X(!newRemoteAircraft.getCallsign().isEmpty(), Q_FUNC_INFO, "empty callsign");
|
||||||
Q_ASSERT_X(newRemoteAircraft.hasModelString(), Q_FUNC_INFO, "missing model string");
|
Q_ASSERT_X(newRemoteAircraft.hasModelString(), Q_FUNC_INFO, "missing model string");
|
||||||
|
|
||||||
@@ -823,7 +823,7 @@ namespace BlackSimPlugin
|
|||||||
if (this->isShuttingDownOrDisconnected()) { return false; }
|
if (this->isShuttingDownOrDisconnected()) { return false; }
|
||||||
|
|
||||||
// only remove from sim
|
// only remove from sim
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "wrong thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "wrong thread");
|
||||||
if (callsign.isEmpty()) { return false; } // can happen if an object is not an aircraft
|
if (callsign.isEmpty()) { return false; } // can happen if an object is not an aircraft
|
||||||
|
|
||||||
// really remove from simulator
|
// really remove from simulator
|
||||||
@@ -901,7 +901,7 @@ namespace BlackSimPlugin
|
|||||||
if (weatherGrid.isEmpty()) { return; }
|
if (weatherGrid.isEmpty()) { return; }
|
||||||
if (!this->isWeatherActivated()) { return; }
|
if (!this->isWeatherActivated()) { return; }
|
||||||
|
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isInThisThread(this))
|
||||||
{
|
{
|
||||||
|
|
||||||
BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread");
|
BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread");
|
||||||
@@ -1003,7 +1003,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
void CSimulatorXPlane::updateRemoteAircraft()
|
void CSimulatorXPlane::updateRemoteAircraft()
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "thread");
|
||||||
|
|
||||||
const int remoteAircraftNo = this->getAircraftInRangeCount();
|
const int remoteAircraftNo = this->getAircraftInRangeCount();
|
||||||
if (remoteAircraftNo < 1) { return; }
|
if (remoteAircraftNo < 1) { return; }
|
||||||
@@ -1467,7 +1467,7 @@ namespace BlackSimPlugin
|
|||||||
void CSimulatorXPlaneListener::checkConnection()
|
void CSimulatorXPlaneListener::checkConnection()
|
||||||
{
|
{
|
||||||
if (this->isShuttingDown()) { return; }
|
if (this->isShuttingDown()) { return; }
|
||||||
Q_ASSERT_X(!CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "Expect to run in background");
|
Q_ASSERT_X(!CThreadUtils::thisIsMainThread(), Q_FUNC_INFO, "Expect to run in background");
|
||||||
QElapsedTimer t; t.start();
|
QElapsedTimer t; t.start();
|
||||||
|
|
||||||
QString via;
|
QString via;
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ void SwiftGuiStd::performGracefulShutdown()
|
|||||||
if (!m_init) { return; }
|
if (!m_init) { return; }
|
||||||
m_init = false;
|
m_init = false;
|
||||||
|
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "Should shutdown in main thread");
|
Q_ASSERT_X(CThreadUtils::thisIsMainThread(), Q_FUNC_INFO, "Should shutdown in main thread");
|
||||||
|
|
||||||
// shut down all timers
|
// shut down all timers
|
||||||
this->stopAllTimers(true);
|
this->stopAllTimers(true);
|
||||||
@@ -519,7 +519,7 @@ void SwiftGuiStd::checkDbDataLoaded()
|
|||||||
{
|
{
|
||||||
if (!sGui || sGui->isShuttingDown()) { return; }
|
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||||
Q_ASSERT_X(sGui->hasWebDataServices(), Q_FUNC_INFO, "Missing web services");
|
Q_ASSERT_X(sGui->hasWebDataServices(), Q_FUNC_INFO, "Missing web services");
|
||||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "Wrong thread, needs to run in main thread");
|
Q_ASSERT_X(CThreadUtils::thisIsMainThread(), Q_FUNC_INFO, "Wrong thread, needs to run in main thread");
|
||||||
const CEntityFlags::Entity loadEntities = sGui->getWebDataServices()->getSynchronizedEntitiesWithNewerSharedFileOrEmpty(!m_dbDataLoading);
|
const CEntityFlags::Entity loadEntities = sGui->getWebDataServices()->getSynchronizedEntitiesWithNewerSharedFileOrEmpty(!m_dbDataLoading);
|
||||||
if (loadEntities == CEntityFlags::NoEntity)
|
if (loadEntities == CEntityFlags::NoEntity)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user