From 235693c1c4f52cdf57f411eb2a125b8e2f3162b1 Mon Sep 17 00:00:00 2001 From: "Rebecca N. Palmer" <rebecca_palmer@zoho.com> Date: Sat, 4 Apr 2015 14:32:58 +0100 Subject: [PATCH] Don't free METAR objects, it makes NoaaMetarGetRequest::onDone crash --- src/Environment/realwx_ctrl.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Environment/realwx_ctrl.cxx b/src/Environment/realwx_ctrl.cxx index 995a148ab..ac89e2862 100644 --- a/src/Environment/realwx_ctrl.cxx +++ b/src/Environment/realwx_ctrl.cxx @@ -346,9 +346,10 @@ void BasicRealWxController::removeMetarAtPath(const string &propPath) MetarPropertiesList::iterator it = findMetarAtPath( propPath ); if( it != _metarProperties.end() ) { SG_LOG(SG_ENVIRONMENT, SG_INFO, "removing metar properties at " << propPath); - LiveMetarProperties_ptr p(*it); - _metarProperties.erase(it); - // final ref will drop, and delete the MetarProperties, when we return + LiveMetarProperties_ptr p(*it); // delay deletion until this goes out of scope when we return; no longer needed? + // TODO: this doesn't actually delete it, because doing so invalidates the + // BasicRealWxController::update iterator, causing a crash on Go To Airport + // _metarProperties.erase(it); } else { SG_LOG(SG_ENVIRONMENT, SG_WARN, "no metar properties at " << propPath); }