From: Erik Hofman Date: Fri, 29 Oct 2010 07:10:07 +0000 (+0200) Subject: temporary fix for a crash of the c172 (and possibly other aircraft) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=61788d655863cd20f3ac5fd2fcaa59860f23bd14;p=flightgear.git temporary fix for a crash of the c172 (and possibly other aircraft) --- diff --git a/src/FDM/JSBSim/FGFDMExec.cpp b/src/FDM/JSBSim/FGFDMExec.cpp index bc81cd6f8..6a12cec2b 100644 --- a/src/FDM/JSBSim/FGFDMExec.cpp +++ b/src/FDM/JSBSim/FGFDMExec.cpp @@ -101,11 +101,13 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root) : Root(root) FDMctr = new unsigned int; *FDMctr = 0; Initialize(); + root_overload = (root != NULL); } FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root), FDMctr(fdmctr) { Initialize(); + root_overload = (root != NULL); } void FGFDMExec::Initialize() @@ -194,12 +196,12 @@ FGFDMExec::~FGFDMExec() checkTied( instance ); DeAllocate(); - if (IdFDM == 0) { // Meaning this is no child FDM + if(FDMctr != 0 && !root_overload) { if(Root != 0) { delete Root; Root = 0; } - if(FDMctr != 0) { + if (IdFDM == 0) { // Meaning this is no child FDM delete FDMctr; FDMctr = 0; } diff --git a/src/FDM/JSBSim/FGFDMExec.h b/src/FDM/JSBSim/FGFDMExec.h index 231cadcaa..9d53cd1b5 100644 --- a/src/FDM/JSBSim/FGFDMExec.h +++ b/src/FDM/JSBSim/FGFDMExec.h @@ -524,6 +524,7 @@ private: bool Constructing; bool modelLoaded; bool IsChild; + bool root_overload; string modelName; string AircraftPath; string FullAircraftPath;