1
0
Fork 0

Replace a program segmentation fault by an annoying message

This commit is contained in:
Erik Hofman 2015-12-14 11:14:40 +01:00
parent 7afedb1702
commit a5e516fe8c

View file

@ -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];
}
}