Modified Files:
src/Scripting/NasalSys.cxx: make sure iterators stay valid
This commit is contained in:
parent
4ec7d1553c
commit
227e96afa6
1 changed files with 5 additions and 3 deletions
|
@ -433,12 +433,14 @@ void FGNasalSys::update(double)
|
||||||
{
|
{
|
||||||
if(_purgeListeners) {
|
if(_purgeListeners) {
|
||||||
_purgeListeners = false;
|
_purgeListeners = false;
|
||||||
map<int, FGNasalListener *>::iterator it, end = _listener.end();
|
map<int, FGNasalListener *>::iterator it;
|
||||||
for(it = _listener.end(); --it != end;) {
|
for(it = _listener.end(); it != _listener.end();) {
|
||||||
FGNasalListener *nl = it->second;
|
FGNasalListener *nl = it->second;
|
||||||
if(nl->_dead) {
|
if(nl->_dead) {
|
||||||
_listener.erase(it);
|
_listener.erase(it--);
|
||||||
delete nl;
|
delete nl;
|
||||||
|
} else {
|
||||||
|
--it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue