From: Erik Hofman Date: Sun, 27 Nov 2011 14:10:44 +0000 (+0100) Subject: Properly remove FGFX classes when not needed anymore X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=99bb79c7d59dee204bdef006808e6f8c61ed924b;p=flightgear.git Properly remove FGFX classes when not needed anymore --- diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index f202cfc15..d2e2fe25d 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -144,11 +145,13 @@ FGAIBase::~FGAIBase() { model_removed->setStringValue(props->getPath()); } + if (_refID != 0 && _refID != 1) { + SGSoundMgr *smgr = globals->get_soundmgr(); + smgr->remove("aifx:"+_refID); + } + delete fp; fp = 0; - -// delete _fx; -// _fx = 0; } /** Cleanly remove the model @@ -231,7 +234,7 @@ void FGAIBase::update(double dt) { // initialize the sound configuration SGSoundMgr *smgr = globals->get_soundmgr(); - _fx = new FGFX(smgr, "aifx:"+_name+"-"+_callsign, props); + _fx = new FGFX(smgr, "aifx:"+_refID, props); _fx->init(); } }