]> git.mxchange.org Git - flightgear.git/commitdiff
temporary fix for a crash of the c172 (and possibly other aircraft)
authorErik Hofman <erik@ehofman.com>
Fri, 29 Oct 2010 07:10:07 +0000 (09:10 +0200)
committerErik Hofman <erik@ehofman.com>
Fri, 29 Oct 2010 07:10:07 +0000 (09:10 +0200)
src/FDM/JSBSim/FGFDMExec.cpp
src/FDM/JSBSim/FGFDMExec.h

index bc81cd6f8ae4b2f9043dbc161ddec34dc87dc3a6..6a12cec2bf584dd7757736a511c3a2a7cac76002 100644 (file)
@@ -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;
       }
index 231cadcaaf4e8baef1af563e86d21a2c33b6129a..9d53cd1b5576a31ba99351d253b3d325c1000bb3 100644 (file)
@@ -524,6 +524,7 @@ private:
   bool Constructing;
   bool modelLoaded;
   bool IsChild;
+  bool root_overload;
   string modelName;
   string AircraftPath;
   string FullAircraftPath;