From 8baf72aabd3c2a2f12ebf77e36d332364fd4ac85 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer <torsten@ลง3r.de> Date: Mon, 30 Mar 2015 16:13:01 +0200 Subject: [PATCH] Make command "clear-metar" work Didn't work if the client used a non-expanded property path (like the airport dialog) --- src/Environment/realwx_ctrl.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Environment/realwx_ctrl.cxx b/src/Environment/realwx_ctrl.cxx index 04d79ab38..867e85bed 100644 --- a/src/Environment/realwx_ctrl.cxx +++ b/src/Environment/realwx_ctrl.cxx @@ -342,10 +342,13 @@ void BasicRealWxController::addMetarAtPath(const string& propPath, const string& void BasicRealWxController::removeMetarAtPath(const string &propPath) { + SGPropertyNode_ptr n = fgGetNode(propPath,false); MetarPropertiesList::iterator it = _metarProperties.begin(); for (; it != _metarProperties.end(); ++it) { LiveMetarProperties_ptr p(*it); - if( p->get_root_node()->getPath() == propPath ) { + // don not compare unprocessed property path + // /foo/bar[0]/baz equals /foo/bar/baz + if( p->get_root_node()->getPath() == n->getPath() ) { _metarProperties.erase(it); // final ref will drop, and delete the MetarProperties, when we return return;