mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
[MIRROR] Fix looping timers qdeleted in their callbacks being reinserted [MDB IGNORE] (#16228)
* Fix looping timers qdeleted in their callbacks being reinserted (#69879) Fix looping timers qdeleted in their callbacks Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@ users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@ users.noreply.github.com> * Fix looping timers qdeleted in their callbacks being reinserted Co-authored-by: Penelope Haze <110272328+out-of-phaze@users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@ users.noreply.github.com>
This commit is contained in:
@@ -127,7 +127,9 @@ SUBSYSTEM_DEF(timer)
|
||||
ctime_timer.spent = REALTIMEOFDAY
|
||||
callBack.InvokeAsync()
|
||||
|
||||
if(ctime_timer.flags & TIMER_LOOP)
|
||||
if(ctime_timer.flags & TIMER_LOOP) // Re-insert valid looping client timers into the client timer list.
|
||||
if (QDELETED(ctime_timer)) // Don't re-insert timers deleted inside their callbacks.
|
||||
continue
|
||||
ctime_timer.spent = 0
|
||||
ctime_timer.timeToRun = REALTIMEOFDAY + ctime_timer.wait
|
||||
BINARY_INSERT(ctime_timer, clienttime_timers, /datum/timedevent, ctime_timer, timeToRun, COMPARE_KEY)
|
||||
@@ -173,7 +175,9 @@ SUBSYSTEM_DEF(timer)
|
||||
callBack.InvokeAsync()
|
||||
last_invoke_tick = world.time
|
||||
|
||||
if (timer.flags & TIMER_LOOP) // Prepare looping timers to re-enter the queue
|
||||
if (timer.flags & TIMER_LOOP) // Prepare valid looping timers to re-enter the queue
|
||||
if(QDELETED(timer)) // If a loop is deleted in its callback, we need to avoid re-inserting it.
|
||||
continue
|
||||
timer.spent = 0
|
||||
timer.timeToRun = world.time + timer.wait
|
||||
timer.bucketJoin()
|
||||
|
||||
Reference in New Issue
Block a user