Be lazy and use ref pointers - to remove memory automatically.
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:";
smgr->remove(name.str());
}
- delete fp;
+ if (fp)
+ delete fp;
fp = 0;
}
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;