Continues the painful process of porting Destroy()s, Dels(), and everything else needed for qdel.

This commit is contained in:
PsiOmega
2015-04-17 09:47:19 +02:00
parent 858b56a2e5
commit 4b040d93ba
3 changed files with 29 additions and 3 deletions

View File

@@ -3,8 +3,8 @@ var/datum/controller/process/garbage_collector/garbage_collector
// #define GC_DEBUG 1 // #define GC_DEBUG 1
/datum/controller/process/garbage_collector /datum/controller/process/garbage_collector
var/collection_timeout = 300 //deciseconds to wait to let running procs finish before we just say fuck it and force del() the object var/collection_timeout = 300 //deciseconds to wait to let running procs finish before we just say fuck it and force del() the object
var/max_checks_multiplier = 5 //multiplier (per-decisecond) for calculating max number of tests per SS tick. These tests check if our GC'd objects are actually GC'd var/max_checks_multiplier = 5 //multiplier (per-decisecond) for calculating max number of tests per tick. These tests check if our GC'd objects are actually GC'd
var/max_forcedel_multiplier = 1 //multiplier (per-decisecond) for calculating max number of force del() calls per SS tick. var/max_forcedel_multiplier = 1 //multiplier (per-decisecond) for calculating max number of force del() calls per tick.
var/dels = 0 // number of del()'s we've done this tick var/dels = 0 // number of del()'s we've done this tick
var/list/destroyed = list() // list of refID's of things that should be garbage collected var/list/destroyed = list() // list of refID's of things that should be garbage collected
@@ -16,7 +16,7 @@ var/datum/controller/process/garbage_collector/garbage_collector
/datum/controller/process/garbage_collector/setup() /datum/controller/process/garbage_collector/setup()
name = "garbage" name = "garbage"
schedule_interval = 60 // every 6 seconds schedule_interval = 20 // every 2 seconds
if(!garbage_collector) if(!garbage_collector)
garbage_collector = src garbage_collector = src
@@ -94,6 +94,7 @@ var/datum/controller/process/garbage_collector/garbage_collector
// This should be overridden to remove all references pointing to the object being destroyed. // This should be overridden to remove all references pointing to the object being destroyed.
// Return true if the the GC controller should allow the object to continue existing. (Useful if pooling objects.) // Return true if the the GC controller should allow the object to continue existing. (Useful if pooling objects.)
/datum/proc/Destroy() /datum/proc/Destroy()
tag = null
return return
/datum/var/gc_destroyed //Time when this object was destroyed. /datum/var/gc_destroyed //Time when this object was destroyed.

View File

@@ -14,6 +14,25 @@
var/moved_recently = 0 var/moved_recently = 0
var/mob/pulledby = null var/mob/pulledby = null
/atom/movable/Del()
if(isnull(gc_destroyed) && loc)
testing("GC: -- [type] was deleted via del() rather than qdel() --")
Destroy()
else if(isnull(gc_destroyed))
testing("GC: [type] was deleted via GC without qdel()") //Not really a huge issue but from now on, please qdel()
// else
// testing("GC: [type] was deleted via GC with qdel()")
..()
/atom/movable/Destroy()
. = ..()
if(reagents)
qdel(reagents)
for(var/atom/movable/AM in contents)
qdel(AM)
loc = null
invisibility = 101
/atom/movable/Bump(var/atom/A, yes) /atom/movable/Bump(var/atom/A, yes)
if(src.throwing) if(src.throwing)
src.throw_impact(A) src.throw_impact(A)

View File

@@ -60,6 +60,12 @@
*/ */
var/list/sprite_sheets_obj = null var/list/sprite_sheets_obj = null
/obj/item/Destroy()
if(ismob(loc))
var/mob/m = loc
m.unEquip(src, 1)
return ..()
/obj/item/device /obj/item/device
icon = 'icons/obj/device.dmi' icon = 'icons/obj/device.dmi'