mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-24 04:28:12 +01:00
Port of @PsiOmegaDelta's Baystation12/Baystation12#16820
Ports tg's garbage collector subsystem and Destroy() returning qdel hints.
This commit is contained in:
@@ -155,4 +155,5 @@ Data storage vars:
|
||||
tag = null
|
||||
arg_list.Cut()
|
||||
stop()
|
||||
return QDEL_HINT_LETMELIVE
|
||||
//Do not call ..()
|
||||
|
||||
@@ -36,4 +36,4 @@
|
||||
|
||||
/decls/Destroy()
|
||||
crash_with("Prevented attempt to delete a decl instance: [log_info_line(src)]")
|
||||
return 1 // Prevents Decl destruction
|
||||
return QDEL_HINT_LETMELIVE // Prevents Decl destruction
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
|
||||
//obtain a weak reference to a datum
|
||||
/proc/weakref(datum/D)
|
||||
if(D.gcDestroyed)
|
||||
if(!istype(D))
|
||||
return
|
||||
if(QDELETED(D))
|
||||
return
|
||||
if(!D.weakref)
|
||||
D.weakref = new/weakref(D)
|
||||
@@ -22,7 +24,7 @@
|
||||
/weakref/Destroy()
|
||||
// A weakref datum should not be manually destroyed as it is a shared resource,
|
||||
// rather it should be automatically collected by the BYOND GC when all references are gone.
|
||||
return 0
|
||||
return QDEL_HINT_LETMELIVE
|
||||
|
||||
/weakref/proc/resolve()
|
||||
var/datum/D = locate(ref)
|
||||
|
||||
Reference in New Issue
Block a user