]> git.mxchange.org Git - flightgear.git/commitdiff
this should now really be correct; nothing for a beauty contest, though
authormfranz <mfranz>
Sun, 28 Jan 2007 22:55:37 +0000 (22:55 +0000)
committermfranz <mfranz>
Sun, 28 Jan 2007 22:55:37 +0000 (22:55 +0000)
src/Scripting/NasalSys.cxx

index f4d6a5db3aa47608628ae8a0880ab58bf72957fc..68119ed287fc655407553b5de7d14b702689261e 100644 (file)
@@ -433,11 +433,13 @@ void FGNasalSys::update(double)
 {
     if(_purgeListeners) {
         _purgeListeners = false;
-        map<int, FGNasalListener *>::iterator it;
-        for(it = _listener.end(); --it != _listener.end();) {
-            FGNasalListener *nl = it->second;
+        map<int, FGNasalListener *>::reverse_iterator it, eit;
+        map<int, FGNasalListener *>::reverse_iterator end = _listener.rend();
+        for(it = _listener.rbegin(); it != end; ) {
+            eit = it++;
+            FGNasalListener *nl = eit->second;
             if(nl->_dead) {
-                _listener.erase(it);
+                _listener.erase((++eit).base());
                 delete nl;
             }
         }