diff --git a/src/blackcore/db/icaodatareader.cpp b/src/blackcore/db/icaodatareader.cpp index 59079e793..3b58078a7 100644 --- a/src/blackcore/db/icaodatareader.cpp +++ b/src/blackcore/db/icaodatareader.cpp @@ -124,6 +124,7 @@ namespace BlackCore void CIcaoDataReader::ps_read(BlackMisc::Network::CEntityFlags::Entity entities, const QDateTime &newerThan) { this->threadAssertCheck(); // runs in background thread + if (this->isAbandoned()) { return; } CEntityFlags::Entity entitiesTriggered = CEntityFlags::NoEntity; if (entities.testFlag(CEntityFlags::AircraftIcaoEntity)) @@ -219,6 +220,8 @@ namespace BlackCore // wrap pointer, make sure any exit cleans up reply // required to use delete later as object is created in a different thread QScopedPointer nwReply(nwReplyPtr); + if (this->isAbandoned()) { return; } + QString urlString(nwReply->url().toString()); CDatabaseReader::JsonDatastoreResponse res = this->setStatusAndTransformReplyIntoDatastoreResponse(nwReply.data()); if (res.hasErrorMessage()) @@ -245,6 +248,8 @@ namespace BlackCore void CIcaoDataReader::ps_parseAirlineIcaoData(QNetworkReply *nwReplyPtr) { QScopedPointer nwReply(nwReplyPtr); + if (this->isAbandoned()) { return; } + QString urlString(nwReply->url().toString()); CDatabaseReader::JsonDatastoreResponse res = this->setStatusAndTransformReplyIntoDatastoreResponse(nwReply.data()); if (res.hasErrorMessage()) diff --git a/src/blackcore/db/modeldatareader.cpp b/src/blackcore/db/modeldatareader.cpp index 10d876db4..b0cdd1c32 100644 --- a/src/blackcore/db/modeldatareader.cpp +++ b/src/blackcore/db/modeldatareader.cpp @@ -150,6 +150,7 @@ namespace BlackCore void CModelDataReader::ps_read(CEntityFlags::Entity entity, const QDateTime &newerThan) { this->threadAssertCheck(); + if (this->isAbandoned()) { return; } CEntityFlags::Entity triggeredRead = CEntityFlags::NoEntity; if (entity.testFlag(CEntityFlags::LiveryEntity)) @@ -220,6 +221,7 @@ namespace BlackCore // wrap pointer, make sure any exit cleans up reply // required to use delete later as object is created in a different thread QScopedPointer nwReply(nwReplyPtr); + if (this->isAbandoned()) { return; } QString urlString(nwReply->url().toString()); CDatabaseReader::JsonDatastoreResponse res = this->setStatusAndTransformReplyIntoDatastoreResponse(nwReply.data()); if (res.hasErrorMessage()) @@ -257,7 +259,10 @@ namespace BlackCore void CModelDataReader::ps_parseDistributorData(QNetworkReply *nwReplyPtr) { + // wrap pointer, make sure any exit cleans up reply + // required to use delete later as object is created in a different thread QScopedPointer nwReply(nwReplyPtr); + if (this->isAbandoned()) { return; } QString urlString(nwReply->url().toString()); CDatabaseReader::JsonDatastoreResponse res = this->setStatusAndTransformReplyIntoDatastoreResponse(nwReply.data()); if (res.hasErrorMessage()) @@ -293,7 +298,10 @@ namespace BlackCore void CModelDataReader::ps_parseModelData(QNetworkReply *nwReplyPtr) { + // wrap pointer, make sure any exit cleans up reply + // required to use delete later as object is created in a different thread QScopedPointer nwReply(nwReplyPtr); + if (this->isAbandoned()) { return; } QString urlString(nwReply->url().toString()); CDatabaseReader::JsonDatastoreResponse res = this->setStatusAndTransformReplyIntoDatastoreResponse(nwReply.data()); if (res.hasErrorMessage())