Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable hard deletes (whoopsie daisy) #3564

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions code/controllers/subsystem/garbage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ SUBSYSTEM_DEF(garbage)
#endif
#endif

// monkestation start: disabling hard deletes
/// Toggle for enabling/disabling hard deletes. Objects that don't explicitly request hard deletion with this disabled will leak.
var/enable_hard_deletes = FALSE
var/list/failed_hard_deletes = list()
// monkestation end


/datum/controller/subsystem/garbage/PreInit()
InitQueues()
Expand Down Expand Up @@ -244,7 +250,8 @@ SUBSYSTEM_DEF(garbage)
#endif
continue
if (GC_QUEUE_HARDDELETE)
HardDelete(D)
if(!HardDelete(D))
D = null
if (MC_TICK_CHECK)
return
continue
Expand Down Expand Up @@ -279,7 +286,14 @@ SUBSYSTEM_DEF(garbage)
queue[++queue.len] = list(queue_time, D, D.gc_destroyed) // not += for byond reasons

//this is mainly to separate things profile wise.
/datum/controller/subsystem/garbage/proc/HardDelete(datum/D)
/datum/controller/subsystem/garbage/proc/HardDelete(datum/D, override = FALSE)
// monkestation start: disable hard deletes
if(!D)
return
if(!enable_hard_deletes)
failed_hard_deletes |= D
return
// monkestation end
++delslasttick
++totaldels
var/type = D.type
Expand Down Expand Up @@ -406,10 +420,10 @@ SUBSYSTEM_DEF(garbage)
SSgarbage.Queue(to_delete, GC_QUEUE_HARDDELETE)
if (QDEL_HINT_HARDDEL_NOW) //qdel should assume this object won't gc, and hard del it post haste.
SSdemo.mark_destroyed(to_delete) // monkestation edit: replays
SSgarbage.HardDelete(to_delete)
SSgarbage.HardDelete(to_delete, override = TRUE)
#ifdef REFERENCE_TRACKING
if (QDEL_HINT_FINDREFERENCE) //qdel will, if REFERENCE_TRACKING is enabled, display all references to this object, then queue the object for deletion.
SSgarbage.Queue(to_delete)
SSgarbage.HardDelete(to_delete, override = TRUE) // Need to override enable_hard_deletes, stuff like /client uses this
INVOKE_ASYNC(to_delete, TYPE_PROC_REF(/datum, find_references))
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.Queue(to_delete)
Expand Down
Loading