Bug 55811

Summary: crash when unit's target is destroyed and removed
Product: [Applications] boson Reporter: Rivo Laks <rivolaks>
Component: generalAssignee: The Boson Team <boson-bugs>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Rivo Laks 2003-03-10 21:35:40 UTC
Version:            (using KDE 3.1.1)
Installed from:    compiled sources
Compiler:          gcc version 3.2.1
OS:          Linux (i686) release 2.4.18

When unit has a target (another unit) and this target gets destroyed and deleted, then if attacker's weapon's reloading time is > 200, target will be deleted before it's set to null in attacker and attacker will use wrong target pointer and crash.
Andi, you wanted to fix this by iterating over all units and checking their targets whenever some unit got deleted.

Rivo
Comment 1 Andreas Beckermann 2003-03-13 02:57:58 UTC
This should be fixed now (see my cvs log). 
I did not test it, so if you have a map / savegame with these conditions around it would be 
nice if you tested it. 
 
I am also not sure if we should call setWork(WorkNone) on the units that had the deleted 
unit as target - currently we just call setTarget(0). I'm not sure if that is enough - we'll see 
whether it causes ERROR or WARNING lines (that would be the worst thing that could 
happen, btw). 
 
CU 
Andi 
 
Comment 2 Rivo Laks 2003-03-19 23:14:44 UTC
It wasn't actually fixed - you had made a typo in bosoncanvas.cpp. But now I fixed it 
and it works. 
 
Rivo