Repository navigation
Commit 6873518
committed
Fix a leak of BattleUnitKills if the debrief is not shown
The destructor for a BattleUnit doesn't delete the BattleUnitKills if
there is a valid Soldier* for the unit, on the assumption that the
object will pass ownership to the SoldierDiary, but that ownership move
only occurs on the DebriefingState, so if you happen to leave a battle
in a way that doesn't show that it will leak (e.g. 'Abandon Game')
This changes the BattleUnit destructor to unconditionally destroy any
remaining BattleUnitKills objects, and the SoliderDiary::updateDiary()
function to empty the BattleUnit's list when it takes ownership.1 parent 8e31daf commit 6873518
2 files changed
Lines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
| 299 | + | |
300 | 300 | | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
| 301 | + | |
305 | 302 | | |
306 | 303 | | |
307 | 304 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| |||
0 commit comments