]> git.mxchange.org Git - flightgear.git/commitdiff
Mathias Froehlich: fix refcounting problem that caused submodel crashes
authormfranz <mfranz>
Tue, 18 Oct 2005 18:01:43 +0000 (18:01 +0000)
committermfranz <mfranz>
Tue, 18 Oct 2005 18:01:43 +0000 (18:01 +0000)
src/AIModel/AIBase.cxx

index 7560ff0493192fd7110e7bfdcf45c25346e017e4..e816b232b70d6c5561c472dd1c688ec34362a66f 100644 (file)
@@ -160,7 +160,6 @@ ssgBranch * FGAIBase::load3DModel(const string& fg_root,
                            prop_root,
                            sim_time_sec);
       manager->setModel(path, model);
-      model->ref();
     }
   //else
   //  {
@@ -169,6 +168,10 @@ ssgBranch * FGAIBase::load3DModel(const string& fg_root,
   //    aip.setVisible(false);
   //    globals->get_scenery()->get_scene_graph()->addKid(aip.getSceneGraph());
   // do some setModel stuff.
+  
+  if (model)
+    model->ref();
+
   return model;
 }