Melchior,
Selon Melchior Franz :
> --- 435,443 ----
> _purgeListeners = false;
> map<int, FGNasalListener *>::iterator it;
> ! for(it = _listener.end(); --it != _listener.end();) {
> FGNasalListener *nl = it->second;
> if(nl->_dead) {
> ! _listener.erase(it);
> delete nl;
> }
> }
I am pretty sure it is illegal to use an iterator after it was used for erasing
an item. I think the code below is better and works on every systems :
_purgeListeners = false;
map<int, FGNasalListener *>::iterator it;
for(it = _listener.end(); --it != _listener.end();) {
FGNasalListener *nl = it->second;
if(nl->_dead) {
map<int, FGNasalListener *>::iterator it2 = it++; <= use a copy
of the iterator
_listener.erase(it2); <= to erase the item
delete nl;
}
}
But I thing the purpose of reverse iterators is exactly to do that and the use
of them should be more valid in the end.
-Fred
--
Frédéric Bouvier
http://frfoto.free.fr Photo gallery - album photo
http://www.fotolia.fr/p/2278/partner/2278 Other photo gallery
http://fgsd.sourceforge.net/ FlightGear Scenery Designer
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel