1
0
Fork 0

Fix memory leak with FGAIModelData.

Be lazy and use ref pointers - to remove memory automatically.
This commit is contained in:
ThorstenB 2011-12-09 17:03:14 +01:00
parent 84b31e573c
commit bfb0619f76
2 changed files with 4 additions and 3 deletions

View file

@ -145,7 +145,7 @@ FGAIBase::~FGAIBase() {
model_removed->setStringValue(props->getPath());
}
if (_refID != 0 && _refID != 1) {
if (_fx && _refID != 0 && _refID != 1) {
SGSoundMgr *smgr = globals->get_soundmgr();
stringstream name;
name << "aifx:";
@ -153,6 +153,7 @@ FGAIBase::~FGAIBase() {
smgr->remove(name.str());
}
if (fp)
delete fp;
fp = 0;
}

View file

@ -230,7 +230,7 @@ private:
bool _initialized;
osg::ref_ptr<osg::LOD> _model; //The 3D model LOD object
FGAIModelData* _aimodel;
osg::ref_ptr<FGAIModelData> _aimodel;
string _fxpath;
SGSharedPtr<FGFX> _fx;