mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-07-13 17:23:44 +01:00
Revert "Merge branch 'master' of https://github.com/PolarisSS13/Polaris into NanoGrade"
This reverts commit6bb5409349, reversing changes made tof6a83d5ee0.
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
/datum
|
||||
var/weakref
|
||||
|
||||
/datum/Destroy()
|
||||
weakref = null // Clear this reference to ensure it's kept for as brief duration as possible.
|
||||
. = ..()
|
||||
|
||||
//obtain a weak reference to a datum
|
||||
/proc/weakref(datum/D)
|
||||
if(D.gcDestroyed)
|
||||
return
|
||||
if(!D.weakref)
|
||||
D.weakref = new /datum/weakref(D)
|
||||
return D.weakref
|
||||
|
||||
/datum/weakref
|
||||
var/ref
|
||||
|
||||
/datum/weakref/New(datum/D)
|
||||
ref = "\ref[D]"
|
||||
|
||||
/datum/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
|
||||
|
||||
/datum/weakref/proc/resolve()
|
||||
var/datum/D = locate(ref)
|
||||
if(D && D.weakref == src)
|
||||
return D
|
||||
return null
|
||||
Reference in New Issue
Block a user