1
0
Fork 0

Don't blindly delete the global property tree on reinit

This commit is contained in:
Frederic Bouvier 2010-10-29 09:00:31 +02:00
parent 0147f78d20
commit 6081f24b00
2 changed files with 6 additions and 3 deletions

View file

@ -96,14 +96,14 @@ void checkTied ( FGPropertyManager *node )
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Constructors
FGFDMExec::FGFDMExec(FGPropertyManager* root) : Root(root)
FGFDMExec::FGFDMExec(FGPropertyManager* root) : Root(root), delete_root(false)
{
FDMctr = new unsigned int;
*FDMctr = 0;
Initialize();
}
FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root), FDMctr(fdmctr)
FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root), delete_root(false), FDMctr(fdmctr)
{
Initialize();
}
@ -150,6 +150,7 @@ void FGFDMExec::Initialize()
if (Root == 0) { // Then this is the root FDM
Root = new FGPropertyManager; // Create the property manager
delete_root = true;
FDMctr = new unsigned int; // Create and initialize the child FDM counter
(*FDMctr) = 0;
@ -196,7 +197,8 @@ FGFDMExec::~FGFDMExec()
if (IdFDM == 0) { // Meaning this is no child FDM
if(Root != 0) {
delete Root;
if (delete_root)
delete Root;
Root = 0;
}
if(FDMctr != 0) {

View file

@ -555,6 +555,7 @@ private:
FGTrim* Trim;
FGPropertyManager* Root;
bool delete_root;
FGPropertyManager* instance;
// The FDM counter is used to give each child FDM an unique ID. The root FDM has the ID 0