From c0e1a380d67f4f8142e2e64d9499eade8a87a4a2 Mon Sep 17 00:00:00 2001 From: mfranz Date: Sun, 26 Nov 2006 12:02:06 +0000 Subject: [PATCH] make sure the node for the AI model removal report exists; addressing a node with its path is unsafe at that time --- src/AIModel/AIBase.cxx | 3 ++- src/AIModel/AIBase.hxx | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index de52894b0..da109c1c7 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -52,6 +52,7 @@ const double FGAIBase::lbs_to_slugs = 0.031080950172; //conversion factor FGAIBase::FGAIBase(object_type ot) : props( NULL ), + model_removed( fgGetNode("/ai/models/model-removed", true) ), manager( NULL ), fp( NULL ), _refID( _newAIModelID() ), @@ -77,7 +78,7 @@ FGAIBase::~FGAIBase() { if (props) { SGPropertyNode* parent = props->getParent(); if (parent) { - fgSetString("/ai/models/model-removed", props->getPath()); + model_removed->setStringValue(props->getPath()); parent->removeChild(props->getName(), props->getIndex(), false); } } diff --git a/src/AIModel/AIBase.hxx b/src/AIModel/AIBase.hxx index 8b72958f1..2fa960ace 100644 --- a/src/AIModel/AIBase.hxx +++ b/src/AIModel/AIBase.hxx @@ -80,6 +80,7 @@ public: protected: SGPropertyNode_ptr props; + SGPropertyNode_ptr model_removed; // where to report model removal FGAIManager* manager; // these describe the model's actual state -- 2.39.5