No-cost workers are not removed correctly

Bug #1643209 reported by Notabilis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
High
Unassigned

Bug Description

When more than 100 workers without buildcost enter a warehouse and the warehouse is destroyed after some time, the workers are not removed. In debug builds an assert will fail which crashes the game, in release builds it is probably only a memory leak.

The attached branch removes all free workers when they entering the warehouse, not only carriers. An alternative fix would be to remove the workers when their count is reduced in Warehouse::act().

Found in r8181[trunk].

Steps to reproduce:
- Modify a worker so he has no building cost, i.e.
   buildcost = {},
- Start a debug build game with the matching tribe+
- Build three warehouses some distance from the headquarters
- Surround them with roads which are only connected to the warehouses but not the headquarters
- Remove the road between the warehouses and the headquarters
- Wait a few minutes for the warehouses to generate the free workers (can not be seen)
- Burn/Dismantle two of the warehouses
- Watch the free workers enter the third warehouse
- Wait a few minutes until the warehouses has reduced the counter of the workers but has not removed the workers (can not be seen)
- Destroy the warehouse. The game should crash with a failed assert.

Tags: crash economy

Related branches

GunChleoc (gunchleoc)
tags: added: crash economy
Changed in widelands:
importance: Undecided → High
milestone: none → build20-rc1
GunChleoc (gunchleoc)
Changed in widelands:
status: New → Fix Committed
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build20-rc1

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.