This commit is contained in:
kevinz000
2017-11-08 22:48:03 -08:00
committed by CitadelStationBot
parent ea44e4a1d9
commit b44e31951d
7 changed files with 73 additions and 12 deletions
+6
View File
@@ -3,6 +3,11 @@
var/list/active_timers //for SStimer
var/list/datum_components //for /datum/components
var/ui_screen = "home" //for tgui
<<<<<<< HEAD
=======
var/use_tag = FALSE
var/datum/weakref/weak_reference
>>>>>>> 4edd802... Weak references + Cameras now use them (#32504)
#ifdef TESTING
var/running_find_references
@@ -14,6 +19,7 @@
// Return the appropriate QDEL_HINT; in most cases this is QDEL_HINT_QUEUE.
/datum/proc/Destroy(force=FALSE, ...)
tag = null
weak_reference = null //ensure prompt GCing of weakref.
var/list/timers = active_timers
active_timers = null
for(var/thing in timers)
+19
View File
@@ -0,0 +1,19 @@
/proc/WEAKREF(datum/input)
if(istype(input) && !QDELETED(input))
if(!input.weak_reference)
input.weak_reference = new /datum/weakref(input)
return input.weak_reference
/datum/weakref
var/reference
/datum/weakref/New(datum/thing)
reference = REF(thing)
/datum/weakref/Destroy()
return QDEL_HINT_LETMELIVE //Let BYOND autoGC thiswhen nothing is using it anymore.
/datum/weakref/proc/resolve()
var/datum/D = locate(reference)
return D.weak_reference == src? D : null