aircraft are often in several state lists at the same time, and they can
even be more than once in the same list. We need to remove all such instances, or the a pointer to TowerPlaneRec may become invalid and cause crashes. The proper fix would, of course, be to be careful with state changes and to prevent *any* duplication of entries. [OK'ed by David]
This commit is contained in:
parent
ec5ea9f344
commit
c0c9d51c09
1 changed files with 9 additions and 9 deletions
|
@ -204,13 +204,11 @@ FGTower::FGTower() {
|
|||
update_count_max = 15;
|
||||
|
||||
holdListItr = holdList.begin();
|
||||
appList.clear();
|
||||
appListItr = appList.begin();
|
||||
depListItr = depList.begin();
|
||||
rwyListItr = rwyList.begin();
|
||||
circuitListItr = circuitList.begin();
|
||||
trafficListItr = trafficList.begin();
|
||||
vacatedList.clear();
|
||||
vacatedListItr = vacatedList.begin();
|
||||
|
||||
freqClear = true;
|
||||
|
@ -2173,7 +2171,9 @@ void FGTower::RemovePlane(const string& ID) {
|
|||
t = *twrItr;
|
||||
twrItr = appList.erase(twrItr);
|
||||
appListItr = appList.begin();
|
||||
break;
|
||||
// HACK: aircraft are sometimes more than once in a list, so we need to
|
||||
// remove them all before we can delete the TowerPlaneRec class
|
||||
//break;
|
||||
}
|
||||
}
|
||||
for(twrItr = depList.begin(); twrItr != depList.end(); twrItr++) {
|
||||
|
@ -2181,7 +2181,7 @@ void FGTower::RemovePlane(const string& ID) {
|
|||
t = *twrItr;
|
||||
twrItr = depList.erase(twrItr);
|
||||
depListItr = depList.begin();
|
||||
break;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
for(twrItr = circuitList.begin(); twrItr != circuitList.end(); twrItr++) {
|
||||
|
@ -2189,7 +2189,7 @@ void FGTower::RemovePlane(const string& ID) {
|
|||
t = *twrItr;
|
||||
twrItr = circuitList.erase(twrItr);
|
||||
circuitListItr = circuitList.begin();
|
||||
break;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
for(twrItr = holdList.begin(); twrItr != holdList.end(); twrItr++) {
|
||||
|
@ -2197,7 +2197,7 @@ void FGTower::RemovePlane(const string& ID) {
|
|||
t = *twrItr;
|
||||
twrItr = holdList.erase(twrItr);
|
||||
holdListItr = holdList.begin();
|
||||
break;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
for(twrItr = rwyList.begin(); twrItr != rwyList.end(); twrItr++) {
|
||||
|
@ -2205,7 +2205,7 @@ void FGTower::RemovePlane(const string& ID) {
|
|||
t = *twrItr;
|
||||
twrItr = rwyList.erase(twrItr);
|
||||
rwyListItr = rwyList.begin();
|
||||
break;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
for(twrItr = vacatedList.begin(); twrItr != vacatedList.end(); twrItr++) {
|
||||
|
@ -2213,7 +2213,7 @@ void FGTower::RemovePlane(const string& ID) {
|
|||
t = *twrItr;
|
||||
twrItr = vacatedList.erase(twrItr);
|
||||
vacatedListItr = vacatedList.begin();
|
||||
break;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
for(twrItr = trafficList.begin(); twrItr != trafficList.end(); twrItr++) {
|
||||
|
@ -2221,7 +2221,7 @@ void FGTower::RemovePlane(const string& ID) {
|
|||
t = *twrItr;
|
||||
twrItr = trafficList.erase(twrItr);
|
||||
trafficListItr = trafficList.begin();
|
||||
break;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
// And finally, delete the record.
|
||||
|
|
Loading…
Add table
Reference in a new issue