Reset the saved order, new order and critical order of a unit when releasing it, fixing a unit reference count error
This commit is contained in:
parent
0dd5fe612d
commit
185f90da58
1 changed files with 13 additions and 0 deletions
|
@ -538,6 +538,19 @@ void CUnit::Release(bool final)
|
|||
}
|
||||
Orders.clear();
|
||||
|
||||
if (SavedOrder != NULL) {
|
||||
delete SavedOrder;
|
||||
SavedOrder = NULL;
|
||||
}
|
||||
if (NewOrder != NULL) {
|
||||
delete NewOrder;
|
||||
NewOrder = NULL;
|
||||
}
|
||||
if (CriticalOrder != NULL) {
|
||||
delete CriticalOrder;
|
||||
CriticalOrder = NULL;
|
||||
}
|
||||
|
||||
// Remove the unit from the global units table.
|
||||
UnitManager.ReleaseUnit(this);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue