mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 14:30:04 +00:00
Hold reference to radar product manager for duration of request
- Avoids early destruction and potential recursive mutex locking
This commit is contained in:
parent
2a12b603fc
commit
5caf0edf95
2 changed files with 10 additions and 7 deletions
|
|
@ -1022,7 +1022,8 @@ void RadarProductManagerImpl::LoadNexradFile(
|
||||||
|
|
||||||
std::shared_ptr<wsr88d::NexradFile> nexradFile = load();
|
std::shared_ptr<wsr88d::NexradFile> nexradFile = load();
|
||||||
|
|
||||||
std::shared_ptr<types::RadarProductRecord> record = nullptr;
|
std::shared_ptr<types::RadarProductRecord> record = nullptr;
|
||||||
|
std::shared_ptr<RadarProductManager> manager = nullptr;
|
||||||
|
|
||||||
bool fileValid = (nexradFile != nullptr);
|
bool fileValid = (nexradFile != nullptr);
|
||||||
|
|
||||||
|
|
@ -1045,9 +1046,7 @@ void RadarProductManagerImpl::LoadNexradFile(
|
||||||
recordRadarId = request->current_radar_site();
|
recordRadarId = request->current_radar_site();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<RadarProductManager> manager =
|
manager = RadarProductManager::Instance(recordRadarId);
|
||||||
RadarProductManager::Instance(recordRadarId);
|
|
||||||
|
|
||||||
manager->Initialize();
|
manager->Initialize();
|
||||||
record = manager->p->StoreRadarProductRecord(record);
|
record = manager->p->StoreRadarProductRecord(record);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include <scwx/qt/request/nexrad_file_request.hpp>
|
#include <scwx/qt/request/nexrad_file_request.hpp>
|
||||||
|
#include <scwx/qt/config/radar_site.hpp>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
|
|
@ -13,12 +14,15 @@ class NexradFileRequest::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Impl(const std::string& currentRadarSite) :
|
explicit Impl(const std::string& currentRadarSite) :
|
||||||
currentRadarSite_ {currentRadarSite}
|
currentRadarSiteId_ {currentRadarSite}
|
||||||
{
|
{
|
||||||
|
// Hold shared pointer to radar site for duration of reqest
|
||||||
|
currentRadarSite_ = config::RadarSite::Get(currentRadarSite);
|
||||||
}
|
}
|
||||||
~Impl() = default;
|
~Impl() = default;
|
||||||
|
|
||||||
const std::string currentRadarSite_;
|
const std::string currentRadarSiteId_;
|
||||||
|
std::shared_ptr<config::RadarSite> currentRadarSite_ {};
|
||||||
|
|
||||||
std::shared_ptr<types::RadarProductRecord> radarProductRecord_ {nullptr};
|
std::shared_ptr<types::RadarProductRecord> radarProductRecord_ {nullptr};
|
||||||
};
|
};
|
||||||
|
|
@ -31,7 +35,7 @@ NexradFileRequest::~NexradFileRequest() = default;
|
||||||
|
|
||||||
std::string NexradFileRequest::current_radar_site() const
|
std::string NexradFileRequest::current_radar_site() const
|
||||||
{
|
{
|
||||||
return p->currentRadarSite_;
|
return p->currentRadarSiteId_;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<types::RadarProductRecord>
|
std::shared_ptr<types::RadarProductRecord>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue