From 4fc54c238cfd7e301f97865450d5034340aaa42b Mon Sep 17 00:00:00 2001 From: duncathan Date: Fri, 4 Sep 2015 22:09:01 -0600 Subject: [PATCH] fixes components not gc'ing; minor tweaks to QDEL_HINT_FINDREFERENCE --- code/ATMOSPHERICS/atmospherics.dm | 10 +++--- .../components/unary_devices/vent_pump.dm | 28 +++++++++++----- .../components/unary_devices/vent_scrubber.dm | 20 +++++++---- code/controllers/subsystem/garbage.dm | 33 ++++++++++--------- code/modules/admin/verbs/debug.dm | 6 +++- 5 files changed, 60 insertions(+), 37 deletions(-) diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index 4a80dc9b944..d8475939dae 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -37,8 +37,7 @@ Pipelines + Other Objects -> Pipe network /obj/machinery/atmospherics/Destroy() for(DEVICE_TYPE_LOOP) - if(NODE_I) - nullifyNode(I) + nullifyNode(I) SSair.atmos_machinery -= src if(stored) @@ -55,9 +54,10 @@ Pipelines + Other Objects -> Pipe network //return QDEL_HINT_FINDREFERENCE /obj/machinery/atmospherics/proc/nullifyNode(I) - var/obj/machinery/atmospherics/N = NODE_I - N.disconnect(src) - NODE_I = null + if(NODE_I) + var/obj/machinery/atmospherics/N = NODE_I + N.disconnect(src) + NODE_I = null //this is called just after the air controller sets up turfs /obj/machinery/atmospherics/proc/atmosinit(var/list/node_connects) diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm index 34a035c01a5..487c3323f04 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm @@ -2,6 +2,9 @@ #define INT_BOUND 2 #define NO_BOUND 3 +#define SIPHONING 0 +#define RELEASING 1 + /obj/machinery/atmospherics/components/unary/vent_pump icon_state = "vent_map" @@ -19,12 +22,12 @@ var/id_tag = null var/on = 0 - var/pump_direction = 1 //0 = siphoning, 1 = releasing + var/pump_direction = RELEASING var/external_pressure_bound = ONE_ATMOSPHERE var/internal_pressure_bound = 0 - var/pressure_checks = 1 + var/pressure_checks = EXT_BOUND //EXT_BOUND: Do not pass external_pressure_bound //INT_BOUND: Do not pass internal_pressure_bound //NO_BOUND: Do not pass either @@ -40,7 +43,7 @@ icon_state = "vent_out" /obj/machinery/atmospherics/components/unary/vent_pump/siphon - pump_direction = 0 + pump_direction = SIPHONING /obj/machinery/atmospherics/components/unary/vent_pump/siphon/on on = 1 @@ -88,9 +91,9 @@ icon_state = "vent_off" return - if(pump_direction) + if(pump_direction & RELEASING) icon_state = "vent_out" - else + if(pump_direction & SIPHONING) icon_state = "vent_in" /obj/machinery/atmospherics/components/unary/vent_pump/process_atmos() @@ -110,7 +113,7 @@ var/datum/gas_mixture/environment = loc.return_air() var/environment_pressure = environment.return_pressure() - if(pump_direction) //internal -> external + if(pump_direction & RELEASING) //internal -> external var/pressure_delta = 10000 if(pressure_checks&EXT_BOUND) @@ -127,7 +130,7 @@ loc.assume_air(removed) air_update_turf() - else //external -> internal + if(pump_direction & SIPHONING) //external -> internal var/pressure_delta = 10000 if(pressure_checks&EXT_BOUND) pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound)) @@ -206,11 +209,11 @@ if("purge" in signal.data) pressure_checks &= ~EXT_BOUND - pump_direction = 0 + pump_direction = SIPHONING if("stabalize" in signal.data) pressure_checks |= EXT_BOUND - pump_direction = 1 + pump_direction = RELEASING if("power" in signal.data) on = text2num(signal.data["power"]) @@ -315,3 +318,10 @@ /obj/machinery/atmospherics/components/unary/vent_pump/can_crawl_through() return !welded + +#undef INT_BOUND +#undef EXT_BOUND +#undef NO_BOUND + +#undef SIPHONING +#undef RELEASING \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm index 2d62d7f84e4..cee4e68b4d5 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm @@ -1,3 +1,6 @@ +#define SIPHONING 0 +#define SCRUBBING 1 + /obj/machinery/atmospherics/components/unary/vent_scrubber icon_state = "scrub_map" @@ -22,7 +25,7 @@ var/list/turf/simulated/adjacent_turfs = list() var/on = 0 - var/scrubbing = 1 //0 = siphoning, 1 = scrubbing + var/scrubbing = SCRUBBING //0 = siphoning, 1 = scrubbing var/scrub_CO2 = 1 var/scrub_Toxins = 0 var/scrub_N2O = 0 @@ -66,14 +69,14 @@ var/amount = idle_power_usage - if (scrubbing) + if(scrubbing & SCRUBBING) if (scrub_CO2) amount += idle_power_usage if (scrub_Toxins) amount += idle_power_usage if (scrub_N2O) amount += idle_power_usage - else + if(scrubbing & SIPHONING) amount = active_power_usage if (widenet) @@ -94,9 +97,9 @@ icon_state = "scrub_off" return - if(scrubbing) + if(scrubbing & SCRUBBING) icon_state = "scrub_on" - else + if(scrubbing & SIPHONING) icon_state = "scrub_purge" /obj/machinery/atmospherics/components/unary/vent_scrubber/proc/set_frequency(new_frequency) @@ -165,7 +168,7 @@ var/datum/gas_mixture/environment = tile.return_air() var/datum/gas_mixture/air_contents = AIR1 - if(scrubbing) + if(scrubbing & SCRUBBING) if((environment.toxins>0) || (environment.carbon_dioxide>0) || (environment.trace_gases.len>0)) var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles() @@ -200,7 +203,7 @@ tile.assume_air(removed) tile.air_update_turf() - else //Just siphoning all air + if(scrubbing & SIPHONING) //Just siphoning all air if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE) return @@ -316,3 +319,6 @@ /obj/machinery/atmospherics/components/unary/vent_scrubber/can_crawl_through() return !welded + +#undef SIPHONING +#undef SCRUBBING \ No newline at end of file diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index ecd7ad159da..d40cd8d4b1c 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -25,6 +25,8 @@ var/datum/subsystem/garbage_collector/SSgarbage var/list/didntgc = list() // list of all types that have failed to GC associated with the number of times that's happened. // the types are stored as strings + var/list/noqdelhint = list()// list of all types that do not return a QDEL_HINT + /datum/subsystem/garbage_collector/New() NEW_SS_GLOBAL(SSgarbage) @@ -99,7 +101,6 @@ var/datum/subsystem/garbage_collector/SSgarbage if (!A) return if (!istype(A)) - //warning("qdel() passed object of type [A.type]. qdel() can only handle /datum types.") del(A) else if (isnull(A.gc_destroyed)) // Let our friend know they're about to get fucked up. @@ -120,14 +121,14 @@ var/datum/subsystem/garbage_collector/SSgarbage if (QDEL_HINT_PUTINPOOL) //qdel will put this object in the pool. PlaceInPool(A,0) if (QDEL_HINT_FINDREFERENCE)//qdel will, if TESTING is enabled, display all references to this object, then queue the object for deletion. - #ifdef TESTING - A.to_be_queued = TRUE - A.find_references() - #else SSgarbage.Queue(A) + #ifdef TESTING + A.find_references() #endif else - testing("WARNING: \ref[A] \[[A.type]] is not returning a qdel hint. It is being placed in the queue.") + if(!("[A.type]" in noqdelhint)) + noqdelhint += "[A.type]" + testing("WARNING: [A.type] is not returning a qdel hint. It is being placed in the queue. Further instances of this type will also be queued.") SSgarbage.Queue(A) // Returns 1 if the object has been queued for deletion. @@ -150,7 +151,6 @@ var/datum/subsystem/garbage_collector/SSgarbage #ifdef TESTING /client/var/running_find_references /datum/var/running_find_references -/datum/var/to_be_queued = FALSE /datum/verb/find_references() set category = "Debug" @@ -164,14 +164,18 @@ var/datum/subsystem/garbage_collector/SSgarbage testing("CANCELLED search for references to a [usr.client.running_find_references].") usr.client.running_find_references = null running_find_references = null + //restart the garbage collector + SSgarbage.can_fire = 1 + SSgarbage.next_fire = world.time + world.tick_lag return if(alert("Running this will create a lot of lag until it finishes. You can cancel it by running it again. Would you like to begin the search?", "Find References", "Yes", "No") == "No") running_find_references = null return - // Remove this object from the list of things to be auto-deleted. - if(SSgarbage && ("\ref[src]" in SSgarbage.queue)) - SSgarbage.queue -= "\ref[src]" + + //this keeps the garbage collector from failing to collect objects being searched for in here + SSgarbage.can_fire = 0 + if(usr && usr.client) usr.client.running_find_references = type @@ -196,9 +200,9 @@ var/datum/subsystem/garbage_collector/SSgarbage usr.client.running_find_references = null running_find_references = null - if(to_be_queued == TRUE) - to_be_queued = FALSE - SSgarbage.Queue(src) + //restart the garbage collector + SSgarbage.can_fire = 1 + SSgarbage.next_fire = world.time + world.tick_lag /client/verb/purge_all_destroyed_objects() set category = "Debug" @@ -218,6 +222,5 @@ var/datum/subsystem/garbage_collector/SSgarbage qdel(src) if(!running_find_references) - to_be_queued = TRUE //find_references removes the object from the queue; - find_references() //this ensures the object will be queued again once find_references has completed + find_references() #endif \ No newline at end of file diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 976ce7085e3..e749a51d01e 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -120,7 +120,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that /client/proc/get_callproc_args() var/argnum = input("Number of arguments","Number:",0) as num|null if(!argnum && (argnum!=0)) return - + var/list/lst = list() //TODO: make a list to store whether each argument was initialised as null. //Reason: So we can abort the proccall if say, one of our arguments was a mob which no longer exists @@ -1100,6 +1100,10 @@ var/global/list/g_fancy_list_of_types = null for(var/path in SSgarbage.didntgc) dat += "[path] - [SSgarbage.didntgc[path]] times
" + dat += "List of paths that did not return a qdel hint in Destroy()

" + for(var/path in SSgarbage.noqdelhint) + dat += "[path]
" + usr << browse(dat, "window=dellog")