Deallocated Memory on teardown of Military site
Bug #1733812 reported by
Klaus Halfmann
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
High
|
Unassigned |
Bug Description
I wanted to teardown some militray bulding, and closed the building window before
Game:think() was called. So the BuildingWindow has already died() but still
got some notification.
Call stack looks like:
Player:
...
BuildingWindow:
-> building_.serial() -> Use of deallocated Memory
* A quick fix would be:
void BuildingWindow:
if (!is_dying && note.serial == building_.serial()) {
switch (note.action) {
* Should this not be done via some "unregestration"? this would mean
that we would leak some Memory for every such subscription?
Related branches
lp:~widelands-dev/widelands/fix_invalid_memory_access_on_dismantle
- Klaus Halfmann: Approve (review)
- GunChleoc: Approve
-
Diff: 33 lines (+11/-1)2 files modifiedsrc/wui/buildingwindow.cc (+5/-0)
src/wui/productionsitewindow.cc (+6/-1)
tags: | added: crash |
tags: | added: asan |
Changed in widelands: | |
status: | In Progress → Fix Committed |
assignee: | SirVer (sirver) → nobody |
To post a comment you must log in.
Same problem in ProductionSiteW indow, check for !is_dying_ is already there but was
done _after_ the broken access.