From 0c7d2b23f4612d1404aff3c5e330da895e3aa3fd Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Sat, 3 Feb 2018 16:09:59 +0100 Subject: [PATCH] Fix race condition between previous and next weather request Once a weather request was finished, its worker gets destroyed automatically but not immediately. This can cause it to still exist, when the next request is being processed. Therefore wait with sending the fetchingFinished() signal, until the worker is fully destroyed. ref T235 --- src/plugins/weatherdata/gfs/weatherdatagfs.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/weatherdata/gfs/weatherdatagfs.cpp b/src/plugins/weatherdata/gfs/weatherdatagfs.cpp index 630681213..660f9c719 100644 --- a/src/plugins/weatherdata/gfs/weatherdatagfs.cpp +++ b/src/plugins/weatherdata/gfs/weatherdatagfs.cpp @@ -98,7 +98,9 @@ namespace BlackWxPlugin void CWeatherDataGfs::fetchingWeatherDataFinished() { - emit fetchingFinished(); + // If the worker is not destroyed yet, try again in 10 ms. + if (m_parseGribFileWorker) { QTimer::singleShot(10, this, &CWeatherDataGfs::fetchingWeatherDataFinished); } + else { emit fetchingFinished(); } } void CWeatherDataGfs::parseGfsFile(QNetworkReply *nwReplyPtr)