Fix memory leak with FGAIModelData.
Be lazy and use ref pointers - to remove memory automatically.
This commit is contained in:
parent
84b31e573c
commit
bfb0619f76
2 changed files with 4 additions and 3 deletions
|
@ -145,7 +145,7 @@ FGAIBase::~FGAIBase() {
|
||||||
model_removed->setStringValue(props->getPath());
|
model_removed->setStringValue(props->getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_refID != 0 && _refID != 1) {
|
if (_fx && _refID != 0 && _refID != 1) {
|
||||||
SGSoundMgr *smgr = globals->get_soundmgr();
|
SGSoundMgr *smgr = globals->get_soundmgr();
|
||||||
stringstream name;
|
stringstream name;
|
||||||
name << "aifx:";
|
name << "aifx:";
|
||||||
|
@ -153,7 +153,8 @@ FGAIBase::~FGAIBase() {
|
||||||
smgr->remove(name.str());
|
smgr->remove(name.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
delete fp;
|
if (fp)
|
||||||
|
delete fp;
|
||||||
fp = 0;
|
fp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ private:
|
||||||
bool _initialized;
|
bool _initialized;
|
||||||
osg::ref_ptr<osg::LOD> _model; //The 3D model LOD object
|
osg::ref_ptr<osg::LOD> _model; //The 3D model LOD object
|
||||||
|
|
||||||
FGAIModelData* _aimodel;
|
osg::ref_ptr<FGAIModelData> _aimodel;
|
||||||
|
|
||||||
string _fxpath;
|
string _fxpath;
|
||||||
SGSharedPtr<FGFX> _fx;
|
SGSharedPtr<FGFX> _fx;
|
||||||
|
|
Loading…
Add table
Reference in a new issue