JD-pyprocgame icon indicating copy to clipboard operation
JD-pyprocgame copied to clipboard

delayed gunshot task never cancelled in Sniper mode

Open clempo2 opened this issue 3 years ago • 1 comments

Sniper mode registers a delayed task in its constructor. This delayed task reschedules itself forever. The task is never cancelled because delayed_cancel() is called with the wrong name.

This bug is not very apparent because delayed tasks are not running when the mode is not present in the ModeQueue.

The fix is to register the delayed handler in mode_started() and cancel the handler with the right name in mode_stopped().

clempo2 avatar Oct 01 '21 04:10 clempo2

You can experiment with this test program but be aware it does not simulate the ticking of delayed tasks the same way the run loop and the ModeQueue does. test.zip

clempo2 avatar Oct 01 '21 04:10 clempo2