From 13945c6cd46f0ab3d414c5aa90b609f3c8976b32 Mon Sep 17 00:00:00 2001 From: mfranz Date: Tue, 18 Oct 2005 18:01:43 +0000 Subject: [PATCH] Mathias Froehlich: fix refcounting problem that caused submodel crashes --- src/AIModel/AIBase.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index 7560ff049..e816b232b 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -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; }