Page MenuHomeFeedback Tracker

"Killed" event handler fires only every second handler, and cannot be removed correctly
Closed, ResolvedPublic


If the EH is added multiple times and then player respawns, it will only fire every second EH that was added. If you then respawn again it will fire the same event handlers again, even if you remove them in the event callback.


Operating System
Windows 10 x64
Steps To Reproduce
  1. Create new scenario
  2. Add one player unit
  3. Set MP respawn to "Respawn on Position of Death"
  4. Run in Multiplayer
  5. Execute this code locally 5 times in a row:
player addEventHandler ["Killed", { 
	params ["_unit", "_killer", "_instigator", "_useEffects"]; 
	systemChat format  ["== %1 KILLED %2", _unit, _thisEventHandler];
	_unit removeEventHandler ["Killed", _thisEventHandler]; 
  1. Press respawn
  2. Note that systemChat indicates that only the 0, 2 and 4 instances of the event handler actually fired.
  3. Press respawn again and note that the same instances fire again, even though removeEventHandler is being called in the event callback.
Additional Information

Lou Montana also reproduced this issue.

Event Timeline

billw created this task.Apr 28 2020, 10:26 PM

I just determined that if I don't call removeEventHandler in the callback it executes every callback instance.

Wulf closed this task as Resolved.May 19 2020, 1:57 PM
Wulf claimed this task.
Wulf added a subscriber: Wulf.

Closing then.