]> git.mxchange.org Git - flightgear.git/commitdiff
The most important part is that it fixes possible
authorehofman <ehofman>
Sun, 11 Dec 2005 13:17:20 +0000 (13:17 +0000)
committerehofman <ehofman>
Sun, 11 Dec 2005 13:17:20 +0000 (13:17 +0000)
memory corruption with that iterator decrement past the erase call.

src/ATC/tower.cxx

index 59de9b9395ad65bcf75d8356e2ede45f48a00289..25801f5d63571c937ae841504f43388ee78bed28 100644 (file)
@@ -2151,14 +2151,15 @@ void FGTower::RemovePlane(const string& ID) {
                        t = *twrItr;
                        twrItr = appList.erase(twrItr);
                        appListItr = appList.begin();
+                       break;
                }
        }
        for(twrItr = depList.begin(); twrItr != depList.end(); twrItr++) {
                if((*twrItr)->plane.callsign == ID) {
                        t = *twrItr;
                        twrItr = depList.erase(twrItr);
-                       twrItr--;
                        depListItr = depList.begin();
+                       break;
                }
        }
        for(twrItr = circuitList.begin(); twrItr != circuitList.end(); twrItr++) {
@@ -2166,6 +2167,7 @@ void FGTower::RemovePlane(const string& ID) {
                        t = *twrItr;
                        twrItr = circuitList.erase(twrItr);
                        circuitListItr = circuitList.begin();
+                       break;
                }
        }
        for(twrItr = holdList.begin(); twrItr != holdList.end(); twrItr++) {
@@ -2173,6 +2175,7 @@ void FGTower::RemovePlane(const string& ID) {
                        t = *twrItr;
                        twrItr = holdList.erase(twrItr);
                        holdListItr = holdList.begin();
+                       break;
                }
        }
        for(twrItr = rwyList.begin(); twrItr != rwyList.end(); twrItr++) {
@@ -2180,6 +2183,7 @@ void FGTower::RemovePlane(const string& ID) {
                        t = *twrItr;
                        twrItr = rwyList.erase(twrItr);
                        rwyListItr = rwyList.begin();
+                       break;
                }
        }
        for(twrItr = vacatedList.begin(); twrItr != vacatedList.end(); twrItr++) {
@@ -2187,6 +2191,7 @@ void FGTower::RemovePlane(const string& ID) {
                        t = *twrItr;
                        twrItr = vacatedList.erase(twrItr);
                        vacatedListItr = vacatedList.begin();
+                       break;
                }
        }
        for(twrItr = trafficList.begin(); twrItr != trafficList.end(); twrItr++) {
@@ -2194,6 +2199,7 @@ void FGTower::RemovePlane(const string& ID) {
                        t = *twrItr;
                        twrItr = trafficList.erase(twrItr);
                        trafficListItr = trafficList.begin();
+                       break;
                }
        }
        // And finally, delete the record.