Weakref cleanup (#19382)

* oh god help

* fixes

* oops

* container runtime

---------

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
Will
2026-04-21 04:57:02 -04:00
committed by GitHub
co-authored by Cameron Lennox
parent 47a0e04bae
commit fb4cf2e80a
34 changed files with 107 additions and 9 deletions
+4
View File
@@ -56,6 +56,10 @@
var/list/turfs_to_process
var/strength
/datum/radiation_pulse_information/Destroy(force)
. = ..()
source_ref = null
#define MEDIUM_RADIATION_THRESHOLD_RANGE 0.5
#define EXTREME_RADIATION_CHANCE 30
@@ -29,6 +29,7 @@
viewer.update_action_buttons()
our_hud = null
linked_action = null
last_hovored_ref = null
return ..()
/atom/movable/screen/movable/action_button/proc/can_use(mob/user)
+1 -1
View File
@@ -19,7 +19,7 @@ INITIALIZE_IMMEDIATE(/atom/movable/screen/map_view_tg)
for(var/datum/weakref/client_ref in viewing_clients)
hide_from_client(client_ref.resolve())
QDEL_LIST_NULL(popup_plane_masters)
viewing_clients.Cut()
return ..()
/atom/movable/screen/map_view_tg/proc/generate_view(map_key)
+4
View File
@@ -1011,6 +1011,10 @@
var/static/list/ammo_screen_loc_list = list(ui_ammo_hud1, ui_ammo_hud2, ui_ammo_hud3 ,ui_ammo_hud4)
var/datum/weakref/our_gun
/atom/movable/screen/ammo/Destroy()
. = ..()
our_gun = null
/atom/movable/screen/ammo/Click()
var/mob/user = usr
if(!user.checkClickCooldown())
+4
View File
@@ -31,6 +31,10 @@
if (source)
src.source_ref = WEAKREF(source)
/datum/browser/Destroy(force)
. = ..()
source_ref = null
/datum/browser/proc/user_deleted(datum/source)
SIGNAL_HANDLER
user = null
+4
View File
@@ -55,6 +55,10 @@
if(usr)
user = WEAKREF(usr)
/datum/callback/Destroy(force)
. = ..()
user = null
/world/proc/ImmediateInvokeAsync(thingtocall, proctocall, ...)
set waitfor = FALSE
+4
View File
@@ -71,6 +71,10 @@
antag_holder = new
..()
/datum/mind/Destroy(force)
. = ..()
original_character = null
/datum/mind/proc/transfer_to(mob/living/new_character, force = FALSE)
if(!istype(new_character))
log_world("## DEBUG: transfer_to(): Some idiot has tried to transfer_to() a non mob/living mob. Please inform Carn")
+8
View File
@@ -55,6 +55,14 @@
default_apply_parts()
update_icon()
/obj/machinery/clonepod/Destroy()
for(var/obj/container in containers)
container.forceMove(get_turf(src))
containers.Cut()
locked = FALSE
go_out()
. = ..()
/obj/machinery/clonepod/proc/set_occupant(var/mob/living/L)
SHOULD_NOT_OVERRIDE(TRUE)
if(!L)
+1
View File
@@ -123,6 +123,7 @@ GLOBAL_LIST_EMPTY(entertainment_screens)
vis_contents.Cut()
QDEL_NULL(pinboard)
QDEL_NULL(radio)
showing = null
return ..()
/obj/machinery/computer/security/telescreen/entertainment/proc/toggle()
+4
View File
@@ -140,6 +140,10 @@ GLOBAL_LIST_BOILERPLATE(pointdefense_turrets, /obj/machinery/pointdefense)
default_apply_parts()
update_icon()
/obj/machinery/pointdefense/Destroy(force, ...)
. = ..()
engaging = null
/obj/machinery/pointdefense/get_description_interaction()
. = ..()
if(!id_tag)
@@ -20,6 +20,10 @@
. = ..()
pursuit_target = WEAKREF(find_nearest_target())
/obj/effect/anomaly/bioscrambler/Destroy()
. = ..()
pursuit_target = null
/obj/effect/anomaly/bioscrambler/anomalyEffect(seconds_per_tick)
. = ..()
if(stats)
@@ -31,6 +31,8 @@
/datum/anomaly_stats/Destroy(force)
QDEL_NULL(modifier)
attached_anomaly = null
attached_harvester = null
return ..()
/datum/anomaly_stats/proc/randomize_particle_types()
@@ -15,6 +15,7 @@
var/client/C = CW?.resolve()
if(C)
C.images -= src
clients.Cut()
// Mostly for motion echos, but someone will probably find another use for it... So parent type gets it instead!
/image/client_only/proc/place_from_root(var/turf/At)
+1
View File
@@ -168,6 +168,7 @@
/obj/item/Destroy()
d_stage_overlay = null
exploit_for = null
if(item_tf_spawn_allowed)
GLOB.item_tf_spawnpoints -= src
if(ismob(loc))
@@ -114,6 +114,7 @@
SSradio.remove_object(src, frequency)
for (var/ch_name in channels)
SSradio.remove_object(src, GLOB.radiochannels[ch_name])
bs_tx_weakref = null
return ..()
/obj/item/radio/proc/recalculateChannels()
@@ -24,6 +24,7 @@
qdel(radio)
camera = null
radio = null
showing = null
. = ..()
/obj/item/tvcamera/examine()
@@ -28,6 +28,7 @@
/datum/color_matrix_editor/Destroy(force)
QDEL_NULL(proxy_view)
target = null
return ..()
/datum/color_matrix_editor/tgui_state(mob/user)
+4
View File
@@ -81,6 +81,10 @@
var/datum/weakref/buffered_anomaly = null
/obj/item/anomaly_scanner/Destroy()
. = ..()
buffered_anomaly = null
/obj/item/anomaly_scanner/attack_self(mob/living/user)
. = ..(user)
if(.)
+1
View File
@@ -63,6 +63,7 @@ GLOBAL_LIST_EMPTY(all_cataloguers)
/obj/item/cataloguer/Destroy()
GLOB.all_cataloguers -= src
displayed_data = null
partial_scanned = null
return ..()
/obj/item/cataloguer/update_icon()
+2
View File
@@ -31,6 +31,8 @@ Gunshots/explosions/opening doors/less rare audio (done)
if(halitem.len)
remove_hallucination_item()
our_human = null
halbody = null
halimage = null
. = ..()
/datum/component/hallucinations/proc/make_timer()
+1
View File
@@ -47,6 +47,7 @@
. = ..()
clear_every_clients_images()
qdel_all_images()
clients.Cut()
/obj/effect/fake_attacker/proc/create_images_from(var/atom/clone)
SHOULD_NOT_OVERRIDE(TRUE)
@@ -122,6 +122,7 @@
var/obj/structure/blob/core/B = weakref.resolve()
if(istype(B))
qdel(B)
blobs.Cut()
/datum/event2/event/blob/announce()
if(!ended) // Don't announce if the blobs die early.
@@ -55,6 +55,11 @@
var/turf/last_known_position = null
var/datum/weakref/last_target = null
/obj/item/integrated_circuit/smart/targeted_pathfinder/Destroy()
. = ..()
last_known_position = null
last_target = null
/obj/item/integrated_circuit/smart/targeted_pathfinder/do_work()
var/datum/integrated_io/I = inputs[1]
set_pin_data(IC_OUTPUT, 1, null)
@@ -131,6 +136,11 @@
var/turf/last_known_position = null
var/datum/weakref/last_target = null
/obj/item/integrated_circuit/smart/pathfinding_locomotion/Destroy()
. = ..()
last_known_position = null
last_target = null
/obj/item/integrated_circuit/smart/pathfinding_locomotion/do_work()
var/datum/integrated_io/I = inputs[1]
+4
View File
@@ -72,6 +72,10 @@
origin = WEAKREF(holder)
..()
/datum/modifier/Destroy(force)
. = ..()
origin = null
// Checks if the modifier should be allowed to be applied to the mob before attaching it.
// Override for special criteria, e.g. forbidding robots from receiving it.
/datum/modifier/proc/can_apply(var/mob/living/L, var/suppress_output = FALSE)
+6
View File
@@ -64,6 +64,12 @@
update_icons() //VOREstation edit - overlay runtime fix
default_language = GLOB.all_languages[LANGUAGE_GALCOM] //VOREstation edit - runtime fix
/mob/living/bot/Destroy()
. = ..()
ignore_list.Cut()
patrol_path.Cut()
target_path.Cut()
/mob/living/bot/Life()
..()
if(health <= 0)
+8 -6
View File
@@ -39,12 +39,14 @@
if(spray_blood && prob(5)) // Make a big mess
visible_message("Something flies out of [src]. It seems to be acting oddly.")
var/obj/effect/decal/cleanable/blood/gibs/gib = new /obj/effect/decal/cleanable/blood/gibs(loc)
// TODO - I have a feeling weakrefs will not work in ignore_list, verify this ~Leshana
var/datum/weakref/g = WEAKREF(gib)
ignore_list += g
spawn(600)
ignore_list -= g
var/obj/effect/decal/cleanable/blood/gibs/gib = new /obj/effect/decal/cleanable/blood/gibs(get_turf(src))
ignore_list += gib
addtimer(CALLBACK(src,PROC_REF(clear_ignored_gib), gib), 1 MINUTE, TIMER_DELETE_ME)
/mob/living/bot/cleanbot/proc/clear_ignored_gib(var/obj/gibref)
SHOULD_NOT_OVERRIDE(TRUE)
PRIVATE_PROC(TRUE)
ignore_list -= gibref
/mob/living/bot/cleanbot/handlePanic() // Speed modification based on alert level.
. = 0
@@ -58,6 +58,7 @@
for(var/obj/item/computer_hardware/CH in src.get_all_components())
uninstall_component(null, CH)
qdel(CH)
paired_uavs.Cut()
return ..()
/obj/item/modular_computer/emag_act(var/remaining_charges, var/mob/user)
+4
View File
@@ -17,6 +17,10 @@
var/list/skin_color
var/list/hair_color
/datum/organ_data/Destroy(force)
. = ..()
species = null
/datum/organ_data/proc/setup_from_dna(var/datum/dna/dna)
SHOULD_NOT_OVERRIDE(TRUE)
// Prosfab uses default dna to get vars, lets respect that still
+1
View File
@@ -29,6 +29,7 @@
log_research("[src] disconnected from techweb [stored_research] (destroyed).")
stored_research = null
QDEL_NULL(wires)
loaded_item = null
return ..()
/obj/machinery/rnd/tgui_status(mob/user)
+2
View File
@@ -45,6 +45,8 @@
/obj/machinery/computer/transhuman/resleeving/Destroy()
releasepods()
current_br = null
current_mr = null
return ..()
/obj/machinery/computer/transhuman/resleeving/proc/updatemodules()
+10 -2
View File
@@ -154,6 +154,10 @@
RefreshParts()
update_icon()
/obj/machinery/transhuman/synthprinter/Destroy()
current_br = null
. = ..()
/obj/machinery/transhuman/synthprinter/RefreshParts()
//Scanning modules reduce burn rating by 15 each
@@ -315,6 +319,10 @@
RefreshParts()
update_icon()
/obj/machinery/transhuman/resleever/Destroy()
. = ..()
/obj/machinery/transhuman/resleever/proc/set_occupant(var/mob/living/carbon/human/H)
SHOULD_NOT_OVERRIDE(TRUE)
if(!H)
@@ -512,7 +520,7 @@
playsound(src, 'sound/machines/medbayscanner1.ogg', 100, 1) // Play our sound at the end of the mind injection!
return 1
/obj/machinery/transhuman/resleever/proc/go_out(var/mob/M)
/obj/machinery/transhuman/resleever/proc/go_out()
var/mob/living/carbon/human/occupant = get_occupant()
if(!occupant)
return
@@ -541,7 +549,7 @@
set src in oview(1)
if(usr.stat != 0)
return
src.go_out(usr)
go_out()
add_fingerprint(usr)
return
@@ -41,6 +41,7 @@
var/obj/machinery/shieldgen/SG = our_owner.resolve()
if(SG)
SG.deployed_shields -= src
our_owner = null
. = ..()
/obj/machinery/shield/attackby(obj/item/W as obj, mob/user as mob)
@@ -1140,6 +1140,7 @@
if(DC)
DC.selected_record = FALSE
DC.designer_gui = null // no hardrefs
linked_body_design_console = null
. = ..()
/datum/tgui_module/appearance_changer/body_designer/proc/make_fake_owner()
@@ -44,6 +44,10 @@
crew_announcement = new()
crew_announcement.newscast = TRUE
/datum/tgui_module/communications/Destroy(force)
. = ..()
ATC = null
/datum/tgui_module/communications/tgui_interact(mob/user, datum/tgui/ui)
if(using_map && !(get_z(user) in using_map.contact_levels))
to_chat(user, span_danger("Unable to establish a connection: You're too far away from the station!"))