Replace a program segmentation fault by an annoying message
This commit is contained in:
parent
7afedb1702
commit
a5e516fe8c
1 changed files with 7 additions and 2 deletions
|
@ -42,14 +42,19 @@ FGModelMgr::FGModelMgr ()
|
|||
_models->addChangeListener(_listener);
|
||||
}
|
||||
|
||||
#include <stdio.h>
|
||||
FGModelMgr::~FGModelMgr ()
|
||||
{
|
||||
_models->removeChangeListener(_listener);
|
||||
delete _listener;
|
||||
|
||||
osg::Group *scene_graph = globals->get_scenery()->get_scene_graph();
|
||||
if (!scene_graph)
|
||||
SG_LOG(SG_AIRCRAFT, SG_ALERT, "Warning: The scenegraph wass deleted before the models could be removed");
|
||||
|
||||
for (unsigned int i = 0; i < _instances.size(); i++) {
|
||||
globals->get_scenery()->get_scene_graph()
|
||||
->removeChild(_instances[i]->model->getSceneGraph());
|
||||
if (scene_graph)
|
||||
scene_graph->removeChild(_instances[i]->model->getSceneGraph());
|
||||
delete _instances[i];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue