mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 21:40:55 +01:00
Timers sanity checks Port from TG. (#6125)
This adds timers sanity checks with stack tracing of where it was called. Check are: If timer had no callback(crashes timer) If timer was called with negative wait time. Converts time to 0 and gives call stack. If timer was called on deleted or about to be deleted object. Still runs, but gives call stack If timer had infinite or more wait time. Crashes timer Adds sanity check to beams for timer wait time.
This commit is contained in:
committed by
Erki
parent
03bff09f6e
commit
f38cd3c70b
@@ -359,10 +359,19 @@ var/datum/controller/subsystem/timer/SStimer
|
||||
|
||||
/proc/addtimer(datum/callback/callback, wait, flags)
|
||||
if (!callback)
|
||||
return
|
||||
CRASH("addtimer called without a callback")
|
||||
|
||||
if (wait < 0)
|
||||
crash_with("addtimer called with a negative wait. Converting to 0")
|
||||
|
||||
if (callback.object != GLOBAL_PROC && QDELETED(callback.object) && !QDESTROYING(callback.object))
|
||||
crash_with("addtimer called with a callback assigned to a qdeleted object. In the future such timers will not be supported and may refuse to run or run with a 0 wait")
|
||||
|
||||
wait = max(wait, 0)
|
||||
|
||||
if(wait >= INFINITY)
|
||||
CRASH("Attempted to create timer with INFINITY delay")
|
||||
|
||||
var/hash
|
||||
|
||||
if (flags & TIMER_UNIQUE)
|
||||
|
||||
Reference in New Issue
Block a user