mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 19:35:33 +08:00
Found during T149, use QScopedPointer to destroy QNetworkReply
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a22cd134f8
commit
099afba8a7
@@ -99,16 +99,19 @@ namespace BlackWxPlugin
|
|||||||
emit fetchingFinished();
|
emit fetchingFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWeatherDataGfs::ps_parseGfsFile(QNetworkReply *reply)
|
void CWeatherDataGfs::ps_parseGfsFile(QNetworkReply *nwReplyPtr)
|
||||||
{
|
{
|
||||||
m_gribData = reply->readAll();
|
// wrap pointer, make sure any exit cleans up reply
|
||||||
|
// required to use delete later as object is created in a different thread
|
||||||
|
QScopedPointer<QNetworkReply, QScopedPointerDeleteLater> nwReply(nwReplyPtr);
|
||||||
|
|
||||||
|
m_gribData = nwReply->readAll();
|
||||||
Q_ASSERT_X(!m_parseGribFileWorker, Q_FUNC_INFO, "Worker already running");
|
Q_ASSERT_X(!m_parseGribFileWorker, Q_FUNC_INFO, "Worker already running");
|
||||||
m_parseGribFileWorker = BlackMisc::CWorker::fromTask(this, "parseGribFile", [this]()
|
m_parseGribFileWorker = BlackMisc::CWorker::fromTask(this, "parseGribFile", [this]()
|
||||||
{
|
{
|
||||||
parseGfsFileImpl(m_gribData);
|
parseGfsFileImpl(m_gribData);
|
||||||
});
|
});
|
||||||
m_parseGribFileWorker->then(this, &CWeatherDataGfs::ps_fetchingWeatherDataFinished);
|
m_parseGribFileWorker->then(this, &CWeatherDataGfs::ps_fetchingWeatherDataFinished);
|
||||||
reply->deleteLater();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl CWeatherDataGfs::getDownloadUrl() const
|
QUrl CWeatherDataGfs::getDownloadUrl() const
|
||||||
@@ -211,7 +214,7 @@ namespace BlackWxPlugin
|
|||||||
g2int iseek = 0;
|
g2int iseek = 0;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if(QThread::currentThread()->isInterruptionRequested()) { return; }
|
if (QThread::currentThread()->isInterruptionRequested()) { return; }
|
||||||
|
|
||||||
// Search next grib field
|
// Search next grib field
|
||||||
g2int lskip = 0;
|
g2int lskip = 0;
|
||||||
@@ -260,7 +263,7 @@ namespace BlackWxPlugin
|
|||||||
|
|
||||||
for (const GfsGridPoint &gfsGridPoint : as_const(m_gfsWeatherGrid))
|
for (const GfsGridPoint &gfsGridPoint : as_const(m_gfsWeatherGrid))
|
||||||
{
|
{
|
||||||
if(QThread::currentThread()->isInterruptionRequested()) { return; }
|
if (QThread::currentThread()->isInterruptionRequested()) { return; }
|
||||||
|
|
||||||
CTemperatureLayerList temperatureLayers;
|
CTemperatureLayerList temperatureLayers;
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace BlackWxPlugin
|
|||||||
void ps_fetchingWeatherDataFinished();
|
void ps_fetchingWeatherDataFinished();
|
||||||
|
|
||||||
//! Parsing
|
//! Parsing
|
||||||
void ps_parseGfsFile(QNetworkReply *reply);
|
void ps_parseGfsFile(QNetworkReply *nwReplyPtr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum Grib2CloudLevel
|
enum Grib2CloudLevel
|
||||||
|
|||||||
Reference in New Issue
Block a user