diff --git a/src/blackcore/afv/clients/afvclient.cpp b/src/blackcore/afv/clients/afvclient.cpp index d8ea9ee42..531fff72b 100644 --- a/src/blackcore/afv/clients/afvclient.cpp +++ b/src/blackcore/afv/clients/afvclient.cpp @@ -738,7 +738,7 @@ namespace BlackCore bool CAfvClient::setInputVolumeDb(double valueDb) { - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { // call in background thread of AFVClient to avoid lock issues QPointer myself(this); @@ -986,7 +986,7 @@ namespace BlackCore this->stopAudio(); this->disconnectFrom(); 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() @@ -1398,7 +1398,7 @@ namespace BlackCore bool CAfvClient::setOutputVolumeDb(double valueDb) { - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { // call in background thread of AFVClient to avoid lock issues QPointer myself(this); diff --git a/src/blackcore/airspaceanalyzer.cpp b/src/blackcore/airspaceanalyzer.cpp index f50d4bb75..675bfa644 100644 --- a/src/blackcore/airspaceanalyzer.cpp +++ b/src/blackcore/airspaceanalyzer.cpp @@ -219,7 +219,7 @@ namespace BlackCore 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"); bool restricted, enabled; diff --git a/src/blackcore/airspacemonitor.cpp b/src/blackcore/airspacemonitor.cpp index 959d1579e..41aec4fd4 100644 --- a/src/blackcore/airspacemonitor.cpp +++ b/src/blackcore/airspacemonitor.cpp @@ -562,7 +562,7 @@ namespace BlackCore void CAirspaceMonitor::onReceivedAtcBookings(const CAtcStationList &bookedStations) { - Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this)); + Q_ASSERT(CThreadUtils::isInThisThread(this)); if (bookedStations.isEmpty()) { m_atcStationsBooked.clear(); @@ -592,7 +592,7 @@ namespace BlackCore void CAirspaceMonitor::onReceivedVatsimDataFile() { - Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this)); + Q_ASSERT(CThreadUtils::isInThisThread(this)); if (!sApp || sApp->isShuttingDown() || !sApp->getWebDataServices()) { return; } CClientList clients(this->getClients()); // copy 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) { - 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; } const CAtcStationList stationsWithCallsign = m_atcStationsOnline.findByCallsign(callsign); @@ -780,7 +780,7 @@ namespace BlackCore void CAirspaceMonitor::onAtcControllerDisconnected(const CCallsign &callsign) { - Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this)); + Q_ASSERT(CThreadUtils::isInThisThread(this)); if (!this->isConnectedAndNotShuttingDown()) { return; } this->removeClient(callsign); @@ -798,7 +798,7 @@ namespace BlackCore 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; const bool changedAtis = m_atcStationsOnline.updateIfMessageChanged(atisMessage, callsign, true); @@ -811,7 +811,7 @@ namespace BlackCore void CAirspaceMonitor::onAtisLogoffTimeReceived(const CCallsign &callsign, const QString &zuluTime) { - Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this)); + Q_ASSERT(CThreadUtils::isInThisThread(this)); if (!this->isConnectedAndNotShuttingDown()) { return; } if (zuluTime.length() == 4) @@ -837,7 +837,7 @@ namespace BlackCore // 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 // 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 (!this->isConnectedAndNotShuttingDown()) { return; } @@ -899,7 +899,7 @@ namespace BlackCore 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 (CBuildConfig::isLocalDeveloperDebugBuild()) { BLACK_VERIFY_X(callsign.isValid(), Q_FUNC_INFO, "invalid callsign"); } if (!callsign.isValid()) { return; } @@ -1217,7 +1217,7 @@ namespace BlackCore 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; } const CCallsign callsign(situation.getCallsign()); @@ -1267,7 +1267,7 @@ namespace BlackCore 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; } const CCallsign callsign(situation.getCallsign()); @@ -1329,7 +1329,7 @@ namespace BlackCore void CAirspaceMonitor::onPilotDisconnected(const CCallsign &callsign) { - Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this)); + Q_ASSERT(CThreadUtils::isInThisThread(this)); // in case of inconsistencies I always remove here this->removeFromAircraftCachesAndLogs(callsign); @@ -1340,7 +1340,7 @@ namespace BlackCore void CAirspaceMonitor::onFrequencyReceived(const CCallsign &callsign, const CFrequency &frequency) { - Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this)); + Q_ASSERT(CThreadUtils::isInThisThread(this)); // update 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) { - Q_ASSERT(CThreadUtils::isCurrentThreadObjectThread(this)); + Q_ASSERT(CThreadUtils::isInThisThread(this)); BLACK_AUDIT_X(!callsign.isEmpty(), Q_FUNC_INFO, "Need callsign"); if (callsign.isEmpty()) { return; } @@ -1410,7 +1410,7 @@ namespace BlackCore 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"); if (callsign.isEmpty()) { return; } diff --git a/src/blackcore/application.cpp b/src/blackcore/application.cpp index adee28328..afec40fea 100644 --- a/src/blackcore/application.cpp +++ b/src/blackcore/application.cpp @@ -1769,7 +1769,7 @@ namespace BlackCore { // should be now in QAM thread 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); }); } @@ -1782,7 +1782,7 @@ namespace BlackCore { // should be now in QAM thread 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(); m_networkWatchDog->setNetworkAccessibility(accessibility); }); @@ -1805,13 +1805,13 @@ namespace BlackCore QWriteLocker locker(&m_accessManagerLock); 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); 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()); // If URL is one of the shared URLs, add swift client SSL certificate to request diff --git a/src/blackcore/context/contextaudio.cpp b/src/blackcore/context/contextaudio.cpp index 134c54e69..acaf75e1e 100644 --- a/src/blackcore/context/contextaudio.cpp +++ b/src/blackcore/context/contextaudio.cpp @@ -217,7 +217,7 @@ namespace BlackCore if (m_voiceClient) { 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 = nullptr; #ifdef Q_OS_WIN diff --git a/src/blackcore/context/contextsimulatorimpl.cpp b/src/blackcore/context/contextsimulatorimpl.cpp index 8204a8c89..6ff9247a5 100644 --- a/src/blackcore/context/contextsimulatorimpl.cpp +++ b/src/blackcore/context/contextsimulatorimpl.cpp @@ -461,7 +461,7 @@ namespace BlackCore Q_ASSERT(this->getIContextApplication()); Q_ASSERT(this->getIContextApplication()->isUsingImplementingObject()); 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? if (!m_simulatorPlugin.first.isUnspecified()) diff --git a/src/blackcore/db/databasereader.cpp b/src/blackcore/db/databasereader.cpp index 7cdc21dd7..4dcf10b78 100644 --- a/src/blackcore/db/databasereader.cpp +++ b/src/blackcore/db/databasereader.cpp @@ -619,7 +619,7 @@ namespace BlackCore const bool overrideNewerOnly = true; entities = this->maskBySupportedEntities(entities); - if (inBackground || !CThreadUtils::isCurrentThreadObjectThread(this)) + if (inBackground || !CThreadUtils::isInThisThread(this)) { const bool s = this->readFromJsonFilesInBackground(CDirectoryUtils::staticDbFilesDirectory(), entities, overrideNewerOnly); return s ? diff --git a/src/blackcore/db/networkwatchdog.cpp b/src/blackcore/db/networkwatchdog.cpp index 7d552a949..e9d306baa 100644 --- a/src/blackcore/db/networkwatchdog.cpp +++ b/src/blackcore/db/networkwatchdog.cpp @@ -234,7 +234,7 @@ namespace BlackCore if (m_disableNetworkCheck) { return; } // ignore with disabled check // shift to thread - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { QPointer myself(this); QTimer::singleShot(0, this, [ = ] @@ -315,7 +315,7 @@ namespace BlackCore nw->close(); 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; { diff --git a/src/blackcore/fsd/fsdclient.cpp b/src/blackcore/fsd/fsdclient.cpp index 1b9e74094..e0e68ba25 100644 --- a/src/blackcore/fsd/fsdclient.cpp +++ b/src/blackcore/fsd/fsdclient.cpp @@ -225,7 +225,7 @@ namespace BlackCore void CFSDClient::connectToServer() { - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { QMetaObject::invokeMethod(this, [ = ] { @@ -265,7 +265,7 @@ namespace BlackCore void CFSDClient::disconnectFromServer() { - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { QMetaObject::invokeMethod(this, [ = ] { @@ -441,7 +441,7 @@ namespace BlackCore void CFSDClient::sendClientQuery(ClientQueryType queryType, const CCallsign &receiver, const QStringList &queryData) { if (queryType == ClientQueryType::Unknown) { return; } - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { QMetaObject::invokeMethod(this, [ = ] { @@ -514,7 +514,7 @@ namespace BlackCore void CFSDClient::sendTextMessages(const CTextMessageList &messages) { if (messages.isEmpty()) { return; } - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { QMetaObject::invokeMethod(this, [ = ] { @@ -565,7 +565,7 @@ namespace BlackCore void CFSDClient::sendTextMessage(TextMessageGroups receiverGroup, const QString &message) { if (message.isEmpty()) { return; } - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { QMetaObject::invokeMethod(this, [ = ] { @@ -614,7 +614,7 @@ namespace BlackCore void CFSDClient::sendFlightPlan(const CFlightPlan &flightPlan) { - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { QMetaObject::invokeMethod(this, [ = ] { @@ -671,7 +671,7 @@ namespace BlackCore void CFSDClient::sendPlaneInfoRequest(const CCallsign &receiver) { - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { QMetaObject::invokeMethod(this, [ = ] { @@ -687,7 +687,7 @@ namespace BlackCore void CFSDClient::sendPlaneInfoRequestFsinn(const CCallsign &callsign) { - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { QMetaObject::invokeMethod(this, [ = ] { diff --git a/src/blackcore/simulator.cpp b/src/blackcore/simulator.cpp index 66853630f..993065908 100644 --- a/src/blackcore/simulator.cpp +++ b/src/blackcore/simulator.cpp @@ -343,7 +343,7 @@ namespace BlackCore void ISimulator::safeKillTimer() { 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); m_timerId = -1; } @@ -816,7 +816,7 @@ namespace BlackCore // when changing back from restricted->unrestricted an one time update is required 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"); // restricted snapshot values? @@ -1464,7 +1464,7 @@ namespace BlackCore void ISimulatorListener::start() { if (m_isRunning) { return; } - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { // call in correct thread QPointer myself(this); @@ -1479,7 +1479,7 @@ namespace BlackCore void ISimulatorListener::stop() { if (!m_isRunning) { return; } - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { // call in correct thread QPointer myself(this); @@ -1494,7 +1494,7 @@ namespace BlackCore void ISimulatorListener::check() { if (!m_isRunning) { return; } - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { // call in correct thread QPointer myself(this); diff --git a/src/blackcore/threadedreader.cpp b/src/blackcore/threadedreader.cpp index bc5c4e31d..ab50db3a1 100644 --- a/src/blackcore/threadedreader.cpp +++ b/src/blackcore/threadedreader.cpp @@ -167,7 +167,7 @@ namespace BlackCore if (!this->isEnabled()) { return false; } // 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; } return true; diff --git a/src/blackcore/webdataservices.cpp b/src/blackcore/webdataservices.cpp index 0fb24430d..d251f3ed8 100644 --- a/src/blackcore/webdataservices.cpp +++ b/src/blackcore/webdataservices.cpp @@ -1012,7 +1012,7 @@ namespace BlackCore 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 @@ -1173,7 +1173,7 @@ namespace BlackCore { // run in correct thread if (m_shuttingDown) { return; } - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { const QPointer myself(this); QTimer::singleShot(0, this, [ = ] @@ -1215,7 +1215,7 @@ namespace BlackCore { // run in correct thread if (m_shuttingDown) { return; } - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { const QPointer myself(this); QTimer::singleShot(0, this, [ = ] @@ -1582,7 +1582,7 @@ namespace BlackCore if (m_icaoDataReader) { // 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) { CLogMessage(this).info(u"Reading from disk in background: %1") << m_icaoDataReader->getSupportedEntitiesAsString(); @@ -1600,7 +1600,7 @@ namespace BlackCore if (m_modelDataReader) { // 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) { CLogMessage(this).info(u"Reading from disk in background: %1") << m_modelDataReader->getSupportedEntitiesAsString(); @@ -1618,7 +1618,7 @@ namespace BlackCore if (m_airportDataReader) { // 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) { CLogMessage(this).info(u"Reading from disk in background: %1") << m_airportDataReader->getSupportedEntitiesAsString(); diff --git a/src/blackgui/guiapplication.cpp b/src/blackgui/guiapplication.cpp index 3e0ba86ea..a67c17ce2 100644 --- a/src/blackgui/guiapplication.cpp +++ b/src/blackgui/guiapplication.cpp @@ -1384,7 +1384,7 @@ namespace BlackGui // changing widget style is slow, so I try to prevent setting it when nothing changed const QString widgetStyle = m_guiSettings.get().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)) { const QStringList availableStyles = QStyleFactory::keys(); diff --git a/src/blackgui/loadindicator.cpp b/src/blackgui/loadindicator.cpp index 40a9f5bfe..e013bf7f7 100644 --- a/src/blackgui/loadindicator.cpp +++ b/src/blackgui/loadindicator.cpp @@ -92,7 +92,7 @@ namespace BlackGui m_pendingIds.clear(); 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); } m_timerId = -1; @@ -106,7 +106,7 @@ namespace BlackGui m_delayMs = delay; 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); } m_timerId = this->startTimer(m_delayMs); diff --git a/src/blackgui/models/aircraftcategorytreemodel.cpp b/src/blackgui/models/aircraftcategorytreemodel.cpp index 65ba4ccae..b45b1070f 100644 --- a/src/blackgui/models/aircraftcategorytreemodel.cpp +++ b/src/blackgui/models/aircraftcategorytreemodel.cpp @@ -41,7 +41,7 @@ namespace BlackGui 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(); if (categories.isEmpty()) { return; } diff --git a/src/blackmisc/datacache.h b/src/blackmisc/datacache.h index 983172af2..985471219 100644 --- a/src/blackmisc/datacache.h +++ b/src/blackmisc/datacache.h @@ -395,7 +395,7 @@ namespace BlackMisc // run in page thread //! \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 { QPointer myself(queue); diff --git a/src/blackmisc/digestsignal.cpp b/src/blackmisc/digestsignal.cpp index ec3fa8341..7e871f0d0 100644 --- a/src/blackmisc/digestsignal.cpp +++ b/src/blackmisc/digestsignal.cpp @@ -14,7 +14,7 @@ namespace BlackMisc { void CDigestSignal::inputSignal() { - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { // call in correct thread const QPointer myself(this); diff --git a/src/blackmisc/filedeleter.cpp b/src/blackmisc/filedeleter.cpp index 0d9691b66..863fdf09b 100644 --- a/src/blackmisc/filedeleter.cpp +++ b/src/blackmisc/filedeleter.cpp @@ -62,7 +62,7 @@ namespace BlackMisc Q_UNUSED(event) 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); } m_timerId = -1; diff --git a/src/blackmisc/icons.cpp b/src/blackmisc/icons.cpp index 77d756657..1668901cf 100644 --- a/src/blackmisc/icons.cpp +++ b/src/blackmisc/icons.cpp @@ -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. 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); if (!getResourceFileCache().contains(relativeFileName)) diff --git a/src/blackmisc/simulation/data/modelcaches.h b/src/blackmisc/simulation/data/modelcaches.h index 9e1641e4b..7fab10967 100644 --- a/src/blackmisc/simulation/data/modelcaches.h +++ b/src/blackmisc/simulation/data/modelcaches.h @@ -443,7 +443,7 @@ namespace BlackMisc static CCentralMultiSimulatorModelCachesProvider &modelCachesInstance() { 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; } @@ -496,7 +496,7 @@ namespace BlackMisc static CCentralMultiSimulatorModelSetCachesProvider &modelCachesInstance() { 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; } diff --git a/src/blackmisc/threadutils.cpp b/src/blackmisc/threadutils.cpp index 4642e9212..c74169063 100644 --- a/src/blackmisc/threadutils.cpp +++ b/src/blackmisc/threadutils.cpp @@ -19,12 +19,12 @@ namespace BlackMisc { - bool CThreadUtils::isCurrentThreadObjectThread(const QObject *toBeTested) + bool CThreadUtils::isInThisThread(const QObject *toBeTested) { return QThread::currentThread() == toBeTested->thread(); } - bool CThreadUtils::isCurrentThreadApplicationThread() + bool CThreadUtils::thisIsMainThread() { return qApp && QThread::currentThread() == qApp->thread(); } diff --git a/src/blackmisc/threadutils.h b/src/blackmisc/threadutils.h index 1c8415574..39ee6658b 100644 --- a/src/blackmisc/threadutils.h +++ b/src/blackmisc/threadutils.h @@ -27,10 +27,14 @@ namespace BlackMisc CThreadUtils() = delete; //! 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? - static bool isCurrentThreadApplicationThread(); + //! \deprecated + //! \todo Refactor to inline method + static bool thisIsMainThread(); //! Info about current thread, for debug messages static QString currentThreadInfo(); diff --git a/src/blackmisc/worker.cpp b/src/blackmisc/worker.cpp index 47c5a6e7f..0a44ee2aa 100644 --- a/src/blackmisc/worker.cpp +++ b/src/blackmisc/worker.cpp @@ -163,7 +163,7 @@ namespace BlackMisc if (hasStarted()) { return; } // 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(); setStarted(); auto *thread = new CRegularThread(m_owner); @@ -203,7 +203,7 @@ namespace BlackMisc if (this->thread() == m_owner->thread()) { 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() this->quit(); @@ -224,7 +224,7 @@ namespace BlackMisc void CContinuousWorker::startUpdating(int updateTimeSecs) { Q_ASSERT_X(this->hasStarted(), Q_FUNC_INFO, "Worker not yet started"); - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { // shift in correct thread QPointer myself(this); @@ -254,7 +254,7 @@ namespace BlackMisc if (!m_updateTimer.isActive()) { return; } // avoid "Timers cannot be stopped from another thread" - if (CThreadUtils::isCurrentThreadObjectThread(&m_updateTimer)) + if (CThreadUtils::isInThisThread(&m_updateTimer)) { m_updateTimer.stop(); } diff --git a/src/plugins/simulator/flightgear/simulatorflightgear.cpp b/src/plugins/simulator/flightgear/simulatorflightgear.cpp index de59002fc..d902e0d7e 100644 --- a/src/plugins/simulator/flightgear/simulatorflightgear.cpp +++ b/src/plugins/simulator/flightgear/simulatorflightgear.cpp @@ -501,7 +501,7 @@ namespace BlackSimPlugin if (this->isShuttingDownOrDisconnected()) { return false; } // 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.hasModelString(), Q_FUNC_INFO, "missing model string"); @@ -557,7 +557,7 @@ namespace BlackSimPlugin if (this->isShuttingDownOrDisconnected()) { return false; } // 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 // really remove from simulator @@ -622,7 +622,7 @@ namespace BlackSimPlugin 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(); if (remoteAircraftNo < 1) { return; } @@ -1042,7 +1042,7 @@ namespace BlackSimPlugin void CSimulatorFlightgearListener::checkConnection() { 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(); if (CDBusServer::isSessionOrSystemAddress(dbusAddress)) diff --git a/src/plugins/simulator/fs9/simulatorfs9.cpp b/src/plugins/simulator/fs9/simulatorfs9.cpp index d164a66b6..e76034c3e 100644 --- a/src/plugins/simulator/fs9/simulatorfs9.cpp +++ b/src/plugins/simulator/fs9/simulatorfs9.cpp @@ -515,7 +515,7 @@ namespace BlackSimPlugin if (this->isShuttingDownOrDisconnected()) { return; } if (weatherGrid.isEmpty()) { return; } - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread"); QPointer myself(this); diff --git a/src/plugins/simulator/fscommon/fsuipcimpl.cpp b/src/plugins/simulator/fscommon/fsuipcimpl.cpp index 0f95993de..cf596e192 100644 --- a/src/plugins/simulator/fscommon/fsuipcimpl.cpp +++ b/src/plugins/simulator/fscommon/fsuipcimpl.cpp @@ -73,7 +73,7 @@ namespace BlackSimPlugin 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; m_lastErrorMessage = ""; m_lastErrorIndex = 0; @@ -119,7 +119,7 @@ namespace BlackSimPlugin 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) { CLogMessage(this).info(u"Closing FSUIPC: %1") << m_fsuipcVersion; @@ -150,7 +150,7 @@ namespace BlackSimPlugin 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; } quint16 com1ActiveRaw = static_cast(aircraft.getCom1System().getFrequencyActive().value(CFrequencyUnit::MHz()) * 100); @@ -180,7 +180,7 @@ namespace BlackSimPlugin 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; } // should be the same as writing via SimConnect data area @@ -196,7 +196,7 @@ namespace BlackSimPlugin 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 (weatherGrid.isEmpty()) { return false; } @@ -333,7 +333,7 @@ namespace BlackSimPlugin 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; } // 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) { - 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; char localFsTimeRaw[3]; char modelNameRaw[256]; diff --git a/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp b/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp index 50d9a9c3a..c67b4a965 100644 --- a/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp +++ b/src/plugins/simulator/fsxcommon/simulatorfsxcommon.cpp @@ -1513,7 +1513,7 @@ namespace BlackSimPlugin const bool probe = newRemoteAircraft.isTerrainProbe(); // 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(newRemoteAircraft.hasModelString(), Q_FUNC_INFO, "missing model string"); @@ -1701,7 +1701,7 @@ namespace BlackSimPlugin { if (coordinate.isNull()) { 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("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) { // 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 // clean up anyway @@ -1939,7 +1939,7 @@ namespace BlackSimPlugin void CSimulatorFsxCommon::updateRemoteAircraft() { 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 if (this->isPaused() && m_pausedSimFreezesInterpolation) { return; } @@ -2395,7 +2395,7 @@ namespace BlackSimPlugin if (this->isShuttingDownOrDisconnected()) { return; } if (weatherGrid.isEmpty()) { return; } - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread"); QPointer myself(this); @@ -2841,7 +2841,7 @@ namespace BlackSimPlugin 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 if (this->isShuttingDown() || this->thread()->isInterruptionRequested()) diff --git a/src/plugins/simulator/p3d/simulatorp3d.cpp b/src/plugins/simulator/p3d/simulatorp3d.cpp index 61027ab1b..f043c7750 100644 --- a/src/plugins/simulator/p3d/simulatorp3d.cpp +++ b/src/plugins/simulator/p3d/simulatorp3d.cpp @@ -108,7 +108,7 @@ namespace BlackSimPlugin if (this->isShuttingDown()) { 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 double latDeg = reference.latitude().value(CAngleUnit::deg()); const double lngDeg = reference.longitude().value(CAngleUnit::deg()); diff --git a/src/plugins/simulator/xplane/simulatorxplane.cpp b/src/plugins/simulator/xplane/simulatorxplane.cpp index 5bb02c1ff..2673ea930 100644 --- a/src/plugins/simulator/xplane/simulatorxplane.cpp +++ b/src/plugins/simulator/xplane/simulatorxplane.cpp @@ -765,7 +765,7 @@ namespace BlackSimPlugin if (this->isShuttingDownOrDisconnected()) { return false; } // 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.hasModelString(), Q_FUNC_INFO, "missing model string"); @@ -823,7 +823,7 @@ namespace BlackSimPlugin if (this->isShuttingDownOrDisconnected()) { return false; } // 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 // really remove from simulator @@ -901,7 +901,7 @@ namespace BlackSimPlugin if (weatherGrid.isEmpty()) { return; } if (!this->isWeatherActivated()) { return; } - if (!CThreadUtils::isCurrentThreadObjectThread(this)) + if (!CThreadUtils::isInThisThread(this)) { BLACK_VERIFY_X(!CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO, "Wrong thread"); @@ -1003,7 +1003,7 @@ namespace BlackSimPlugin 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(); if (remoteAircraftNo < 1) { return; } @@ -1467,7 +1467,7 @@ namespace BlackSimPlugin void CSimulatorXPlaneListener::checkConnection() { 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(); QString via; diff --git a/src/swiftguistandard/swiftguistd.cpp b/src/swiftguistandard/swiftguistd.cpp index 8ca4b63ed..1b7feea10 100644 --- a/src/swiftguistandard/swiftguistd.cpp +++ b/src/swiftguistandard/swiftguistd.cpp @@ -112,7 +112,7 @@ void SwiftGuiStd::performGracefulShutdown() if (!m_init) { return; } 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 this->stopAllTimers(true); @@ -519,7 +519,7 @@ void SwiftGuiStd::checkDbDataLoaded() { if (!sGui || sGui->isShuttingDown()) { return; } 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); if (loadEntities == CEntityFlags::NoEntity) {