1
0
Fork 0

Modified Files:

src/Scripting/NasalSys.cxx: make sure iterators stay valid
This commit is contained in:
frohlich 2007-01-28 20:02:49 +00:00
parent 4ec7d1553c
commit 227e96afa6

View file

@ -433,12 +433,14 @@ void FGNasalSys::update(double)
{
if(_purgeListeners) {
_purgeListeners = false;
map<int, FGNasalListener *>::iterator it, end = _listener.end();
for(it = _listener.end(); --it != end;) {
map<int, FGNasalListener *>::iterator it;
for(it = _listener.end(); it != _listener.end();) {
FGNasalListener *nl = it->second;
if(nl->_dead) {
_listener.erase(it);
_listener.erase(it--);
delete nl;
} else {
--it;
}
}
}