mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 13:05:44 +01:00
Fix several hard-dels, add harddel ref tracking (#16174)
This commit is contained in:
@@ -31,9 +31,13 @@ var/datum/controller/subsystem/garbage_collector/SSgarbage
|
||||
// of the immortality qdel hints
|
||||
var/list/noforcerespect = list()
|
||||
|
||||
#ifdef TESTING
|
||||
#ifdef TESTING
|
||||
var/list/qdel_list = list() // list of all types that have been qdel()eted
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef REFERENCE_TRACKING
|
||||
var/list/reference_find_on_fail = list()
|
||||
#endif
|
||||
|
||||
/datum/controller/subsystem/garbage_collector/New()
|
||||
NEW_SS_GLOBAL(SSgarbage)
|
||||
@@ -86,9 +90,16 @@ var/datum/controller/subsystem/garbage_collector/SSgarbage
|
||||
var/starttime = world.time
|
||||
var/starttimeofday = world.timeofday
|
||||
var/idex = 1
|
||||
#ifdef REFERENCE_TRACKING
|
||||
var/ref_searching = FALSE
|
||||
#endif
|
||||
while((queue.len - (idex - 1)) && starttime == world.time && starttimeofday == world.timeofday)
|
||||
if (MC_TICK_CHECK)
|
||||
break
|
||||
#ifdef REFERENCE_TRACKING
|
||||
if (ref_searching)
|
||||
break
|
||||
#endif
|
||||
var/refID = queue[idex]
|
||||
if (!refID)
|
||||
idex++
|
||||
@@ -101,8 +112,16 @@ var/datum/controller/subsystem/garbage_collector/SSgarbage
|
||||
var/datum/A
|
||||
A = locate(refID)
|
||||
if (A && A.gcDestroyed == GCd_at_time) // So if something else coincidently gets the same ref, it's not deleted by mistake
|
||||
#ifdef REFERENCE_TRACKING
|
||||
if(reference_find_on_fail[text_ref(D)])
|
||||
INVOKE_ASYNC(D, TYPE_PROC_REF(/datum, find_references))
|
||||
ref_searching = TRUE
|
||||
#ifdef GC_FAILURE_HARD_LOOKUP
|
||||
A.find_references()
|
||||
else
|
||||
INVOKE_ASYNC(D, TYPE_PROC_REF(/datum, find_references))
|
||||
ref_searching = TRUE
|
||||
#endif
|
||||
reference_find_on_fail -= text_ref(D)
|
||||
#endif
|
||||
|
||||
// Something's still referring to the qdel'd object. Kill it.
|
||||
@@ -117,6 +136,9 @@ var/datum/controller/subsystem/garbage_collector/SSgarbage
|
||||
else
|
||||
++gcedlasttick
|
||||
++totalgcs
|
||||
#ifdef REFERENCE_TRACKING
|
||||
reference_find_on_fail -= text_ref(D)
|
||||
#endif
|
||||
|
||||
if (idex > 1)
|
||||
queue.Cut(1, idex)
|
||||
@@ -222,11 +244,16 @@ var/datum/controller/subsystem/garbage_collector/SSgarbage
|
||||
SSgarbage.HardQueue(D)
|
||||
if (QDEL_HINT_HARDDEL_NOW) //qdel should assume this object won't gc, and hard del it post haste.
|
||||
SSgarbage.HardDelete(D)
|
||||
if (QDEL_HINT_FINDREFERENCE)//qdel will, if TESTING is enabled, display all references to this object, then queue the object for deletion.
|
||||
if (QDEL_HINT_FINDREFERENCE)//qdel will, if REFERENCE_TRACKING is enabled, display all references to this object, then queue the object for deletion.
|
||||
SSgarbage.QueueForQueuing(D)
|
||||
#ifdef TESTING
|
||||
#ifdef REFERENCE_TRACKING
|
||||
D.find_references()
|
||||
#endif
|
||||
if (QDEL_HINT_IFFAIL_FINDREFERENCE) // qdel will, if REFERENCE_TRACKING is enabled and the object fails to collect, display all references to this object
|
||||
SSgarbage.QueueForQueuing(D)
|
||||
#ifdef REFERENCE_TRACKING
|
||||
SSgarbage.reference_find_on_fail[text_ref(D)] = TRUE
|
||||
#endif
|
||||
else
|
||||
if(!SSgarbage.noqdelhint["[D.type]"])
|
||||
SSgarbage.noqdelhint["[D.type]"] = "[D.type]"
|
||||
|
||||
Reference in New Issue
Block a user