Fix Improper Destroys (#22166)

We think the culprit behind this one was VSCode autofilling Destroy()
with . = ..()
which is improper. There's a **surprising** number of improper order
Destroy() procs in the repo, so I might as well get all of them in one
pass. Several of these files are associated with currently known hard
dels, such as the modular computer and organ related dels. More than a
couple were my own mistakes, since the Destroy() or Removed() . = ..()
behavior on signal registering objects also prevents the signal from
being unregistered, which similarly creates a hard del.

Signed-off-by: VMSolidus <evilexecutive@gmail.com>
This commit is contained in:
VMSolidus
2026-04-08 15:52:13 +00:00
committed by GitHub
parent 5cce3fe664
commit a290281d14
37 changed files with 52 additions and 48 deletions
+1 -1
View File
@@ -87,10 +87,10 @@
found_turfs = list()
/datum/pathfind/jps/Destroy(force)
. = ..()
requester = null
end = null
open = null
return ..()
/datum/pathfind/jps/start()
start = start || get_turf(requester)
+1 -1
View File
@@ -98,11 +98,11 @@
var/datum/can_pass_info/pass_info
/datum/pathfind/Destroy(force)
. = ..()
SSpathfinder.active_pathing -= src
SSpathfinder.currentrun -= src
hand_back(null)
avoid = null
return ..()
/**
* "starts" off the pathfinding, by storing the values this datum will need to work later on
+1 -1
View File
@@ -258,8 +258,8 @@
return TRUE
/atom/movable/screen/alert/Destroy()
. = ..()
severity = 0
master = null
owner = null
screen_loc = ""
return ..()
@@ -28,15 +28,15 @@
RegisterSignal(parent, COMSIG_PSI_CHECK_SENSITIVITY, PROC_REF(modify_sensitivity), override = TRUE)
/datum/component/psi_sensitivity/Destroy()
. = ..()
if (!parent)
return
return ..()
// This is the second half of the fundamental pattern for Entity-Component-Systems (ECS)
// When this component is taken away from a datum via RemoveComponent(), such as from a player character
// The component tells the character it no longer wishes to do anything when a specific signal happens.
// We MUST do this for garbage collection reasons, else we'll get hard deletes.
UnregisterSignal(parent, COMSIG_PSI_CHECK_SENSITIVITY)
return ..()
/datum/component/psi_sensitivity/proc/modify_sensitivity(var/parent, var/effective_sensitivity)
SIGNAL_HANDLER
@@ -20,12 +20,12 @@
RegisterSignal(parent, COMSIG_PSI_MIND_POWER, PROC_REF(cancel_power), override = TRUE)
/datum/component/psi_suppression/Destroy()
. = ..()
if (!parent)
return
return ..()
UnregisterSignal(parent, COMSIG_PSI_CHECK_SENSITIVITY)
UnregisterSignal(parent, COMSIG_PSI_MIND_POWER)
return ..()
/datum/component/psi_suppression/proc/modify_sensitivity(var/parent, var/effective_sensitivity)
SIGNAL_HANDLER
+1 -1
View File
@@ -56,8 +56,8 @@
update_icon()
/obj/machinery/stasis_bed/Destroy()
. = ..()
QDEL_NULL(mattress_on)
return ..()
/obj/machinery/stasis_bed/attackby(obj/item/attacking_item, mob/user)
if(default_part_replacement(user, attacking_item))
+2 -2
View File
@@ -42,9 +42,9 @@
toggle_paddles()
/obj/item/defibrillator/Destroy()
. = ..()
QDEL_NULL(paddles)
QDEL_NULL(bcell)
return ..()
/obj/item/defibrillator/loaded //starts with regular power cell for R&D to replace later in the round.
bcell = /obj/item/cell
@@ -651,9 +651,9 @@
var/fail_counter = 0
/obj/item/shockpaddles/standalone/Destroy()
. = ..()
if(fail_counter)
STOP_PROCESSING(SSprocessing, src)
return ..()
/obj/item/shockpaddles/standalone/check_charge(charge_amt)
return TRUE
+1 -1
View File
@@ -34,9 +34,9 @@
QDEL_NULL(sound_token)
/obj/item/geiger/Destroy()
. = ..()
STOP_PROCESSING(SSprocessing, src)
update_sound(0)
return ..()
/obj/item/geiger/process()
if(!scanning)
+1 -1
View File
@@ -24,9 +24,9 @@
var/global/list/overlay_cache = list()
/obj/item/t_scanner/Destroy()
. = ..()
if(on)
set_active(FALSE)
return ..()
/obj/item/t_scanner/update_icon()
icon_state = "t-ray[on]"
+1 -1
View File
@@ -49,7 +49,7 @@ GLOBAL_LIST_INIT_TYPED(rod_recipes, /datum/stack_recipe, list(
. += "Using a welder on two metal rods will recombine them back into a steel sheet."
/obj/item/stack/rods/Destroy()
. = ..()
return ..()
/obj/item/stack/rods/full/Initialize()
. = ..()
+1 -1
View File
@@ -51,8 +51,8 @@
..()
/obj/item/clothing/mask/chewable/Destroy()
. = ..()
STOP_PROCESSING(SSprocessing, src)
return ..()
/obj/item/clothing/mask/chewable/proc/chew()
chewtime--
@@ -46,8 +46,8 @@
cell = new /obj/item/cell/high(src)
/obj/item/cloaking_device/Destroy()
. = ..()
GLOB.cloaking_devices -= src
return ..()
/obj/item/cloaking_device/equipped(var/mob/user, var/slot)
..()
@@ -42,12 +42,12 @@
return TRUE
/obj/item/implant/mindshield/removed()
. = ..()
if(!imp_in)
return
return ..()
UnregisterSignal(imp_in, COMSIG_PSI_CHECK_SENSITIVITY)
UnregisterSignal(imp_in, COMSIG_PSI_MIND_POWER)
return ..()
/obj/item/implant/mindshield/proc/modify_sensitivity(var/implantee, var/effective_sensitivity)
SIGNAL_HANDLER
+1 -1
View File
@@ -41,8 +41,8 @@
detonator.bomb = src
/obj/item/syndie/c4explosive/Destroy()
. = ..()
QDEL_NULL(detonator)
return ..()
/obj/item/syndie/c4explosive/proc/detonate()
icon_state = "c-4[size]_1"
+1 -1
View File
@@ -224,8 +224,8 @@ GLOBAL_LIST_EMPTY_TYPED(preferences_datums, /datum/preferences)
load_and_update_character()
/datum/preferences/Destroy()
. = ..()
QDEL_LIST(char_render_holders)
return ..()
/datum/preferences/proc/load_and_update_character(var/slot)
load_character(slot)
+1 -1
View File
@@ -27,9 +27,9 @@
. += "Its mag-pulse traction system appears to be [state]."
/obj/item/clothing/shoes/magboots/Destroy()
. = ..()
src.shoes = null
src.wearer = null
return ..()
/obj/item/clothing/shoes/magboots/proc/set_slowdown(mob/user)
slowdown = shoes? max(0, shoes.slowdown): 0 //So you can't put on magboots to make you walk faster.
+1 -1
View File
@@ -277,8 +277,8 @@
queue_icon_update()
/obj/item/gun/custom_ka/Destroy()
. = ..()
STOP_PROCESSING(SSprocessing, src)
return ..()
/obj/item/gun/custom_ka/process()
if(installed_cell)
+1 -1
View File
@@ -316,7 +316,7 @@
icon_has_variants = TRUE
/obj/item/stack/material/plasteel/Destroy()
. = ..()
return ..()
/obj/item/stack/material/plasteel/full/Initialize()
. = ..()
+1 -1
View File
@@ -363,8 +363,8 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
use_power_oneoff(1) // Just incase we need to wake up the power system.
/obj/machinery/ai_powersupply/Destroy()
. = ..()
powered_ai = null
return ..()
/obj/machinery/ai_powersupply/process()
if(!powered_ai || powered_ai.stat == DEAD)
@@ -264,8 +264,8 @@
request_player()
/mob/living/silicon/robot/drone/construction/matriarch/Destroy()
. = ..()
SSghostroles.remove_spawn_atom("matriarchmaintdrone", src)
return ..()
/mob/living/silicon/robot/drone/construction/matriarch/request_player()
SSghostroles.add_spawn_atom("matriarchmaintdrone", src)
@@ -203,9 +203,9 @@
mind.assigned_role = "Changeling"
/mob/living/simple_animal/hostile/lesser_changeling/Destroy()
. = ..()
QDEL_NULL(occupant)
QDEL_NULL(untransform_occupant)
return ..()
/mob/living/simple_animal/hostile/lesser_changeling/proc/add_untransform_verb()
if(!occupant)
@@ -179,8 +179,8 @@
SSghostroles.add_spawn_atom("servant", src)
/mob/living/simple_animal/hostile/giant_spider/nurse/servant/Destroy()
. = ..()
SSghostroles.remove_spawn_atom("servant", src)
return ..()
/mob/living/simple_animal/hostile/giant_spider/on_attack_mob(var/mob/hit_mob, var/obj/item/organ/external/limb)
. = ..()
@@ -250,8 +250,8 @@
SSghostroles.add_spawn_atom("hivebotdestroyer", src)
/mob/living/simple_animal/hostile/hivebot/playable/Destroy()
. = ..()
SSghostroles.remove_spawn_atom("hivebotdestroyer", src)
return ..()
/mob/living/simple_animal/hostile/hivebot/playable/ranged
name = "Hivebot marksman"
@@ -277,8 +277,8 @@
SSghostroles.add_spawn_atom("hivebotmarksman", src)
/mob/living/simple_animal/hostile/hivebot/playable/ranged/Destroy()
. = ..()
SSghostroles.remove_spawn_atom("hivebotmarksman", src)
return ..()
/mob/living/simple_animal/hostile/hivebot/playable/overseer
name = "Hivebot overseer"
@@ -303,8 +303,8 @@
SSghostroles.add_spawn_atom("hivebotoverseer", src)
/mob/living/simple_animal/hostile/hivebot/playable/overseer/Destroy()
. = ..()
SSghostroles.remove_spawn_atom("hivebotoverseer", src)
return ..()
/mob/living/simple_animal/hostile/hivebot/playable/overseer/verb/build_bot()
set name = "Assemble hivebot"
@@ -9,7 +9,6 @@
GLOB.ntnet_global.chat_users.Add(src)
/datum/ntnet_user/Destroy(force)
. = ..()
//This notifies every client that might have this as a client to deactivate and clear the reference
for(var/datum/computer_file/program/chat_client/client as anything in GLOB.ntnet_global.chat_clients)
@@ -19,6 +18,7 @@
channels = null
dm_channels = null
clients = null
return ..()
/datum/ntnet_user/proc/generateUsernameIdCard(var/obj/item/card/id/card)
if(!card)
@@ -23,7 +23,7 @@
set_icon()
/obj/item/modular_computer/handheld/Destroy()
. = ..()
return ..()
/obj/item/modular_computer/handheld/proc/set_icon()
icon_state_unpowered = icon_state
@@ -4,7 +4,7 @@
icon_state = "laptop-closed"
/obj/item/modular_computer/laptop/preset/Destroy()
. = ..()
return ..()
/obj/item/modular_computer/laptop/preset/install_default_hardware()
..()
@@ -1,5 +1,5 @@
/obj/item/modular_computer/telescreen/preset/Destroy()
. = ..()
return ..()
/obj/item/modular_computer/telescreen/preset/install_default_hardware()
..()
@@ -22,11 +22,11 @@
RegisterSignal(owner, COMSIG_HEART_PUMP_EVENT, PROC_REF(stabilize_circulation), override = TRUE)
/obj/item/organ/internal/augment/bioaug/auxiliary_heart/removed()
. = ..()
if(!owner)
return
return ..()
UnregisterSignal(owner, COMSIG_HEART_PUMP_EVENT)
return ..()
/obj/item/organ/internal/augment/bioaug/auxiliary_heart/proc/stabilize_circulation(var/implantee, var/obj/item/organ/internal/heart/heart, var/blood_volume, var/recent_pump, var/pulse_mod, var/min_efficiency)
SIGNAL_HANDLER
@@ -21,11 +21,11 @@
RegisterSignal(owner, COMSIG_GRAVITY_WEAKNESS_EVENT, PROC_REF(negate_weakness), override = TRUE)
/obj/item/organ/internal/augment/bioaug/gravity_adaptations/removed()
. = ..()
if(!owner)
return
return ..()
UnregisterSignal(owner, COMSIG_GRAVITY_WEAKNESS_EVENT)
return ..()
/obj/item/organ/internal/augment/bioaug/gravity_adaptations/proc/negate_weakness(var/implantee, var/canceled)
SIGNAL_HANDLER
@@ -24,12 +24,12 @@
RegisterSignal(owner, COMSIG_PSI_CHECK_SENSITIVITY, PROC_REF(modify_sensitivity), override = TRUE)
/obj/item/organ/internal/augment/bioaug/mind_blanker/removed()
. = ..()
if(!owner)
return
return ..()
UnregisterSignal(owner, COMSIG_PSI_MIND_POWER)
UnregisterSignal(owner, COMSIG_PSI_CHECK_SENSITIVITY)
return ..()
/obj/item/organ/internal/augment/bioaug/mind_blanker/proc/cancel_power(var/implantee, var/caster, var/cancelled, var/cancel_return, var/wide_field)
SIGNAL_HANDLER
@@ -24,12 +24,12 @@
RegisterSignal(owner, COMSIG_HEART_BLEED_EVENT, PROC_REF(reduce_bloodloss), override = TRUE)
/obj/item/organ/internal/augment/bioaug/platelet_factories/removed()
. = ..()
if(!owner)
return
return ..()
UnregisterSignal(owner, COMSIG_HEART_PUMP_EVENT)
UnregisterSignal(owner, COMSIG_HEART_BLEED_EVENT)
return ..()
/obj/item/organ/internal/augment/bioaug/platelet_factories/proc/stroke_risk(var/implantee, var/obj/item/organ/internal/heart/heart, var/blood_volume, var/recent_pump, var/pulse_mod, var/min_efficiency)
SIGNAL_HANDLER
@@ -34,11 +34,11 @@
RegisterSignal(owner, COMSIG_PSI_CHECK_SENSITIVITY, PROC_REF(modify_sensitivity), override = TRUE)
/obj/item/organ/internal/augment/bioaug/psi/removed()
. = ..()
if(!owner)
return
return ..()
UnregisterSignal(owner, COMSIG_PSI_CHECK_SENSITIVITY)
return ..()
/obj/item/organ/internal/augment/bioaug/psi/proc/modify_sensitivity(var/implantee, var/effective_sensitivity)
SIGNAL_HANDLER
@@ -22,9 +22,9 @@
owner.AddComponent(/datum/component/armor, list(MELEE = ARMOR_MELEE_SMALL, BULLET = ARMOR_BALLISTIC_MINOR))
/obj/item/organ/internal/augment/bioaug/subdermal_carapace/removed()
. = ..()
if(!owner)
return
return ..()
var/datum/component/armor/armor_component = owner.GetComponent(/datum/component/armor)
qdel(armor_component)
return ..()
@@ -28,8 +28,8 @@
SSmachinery.all_sensors += src
/obj/machinery/power/sensor/Destroy()
. = ..()
SSmachinery.all_sensors -= src
return ..()
// Proc: auto_set_name()
// Parameters: None
@@ -44,9 +44,9 @@
var/kill_loop = 0
/datum/musical_event_manager/Destroy(force)
. = ..()
deactivate()
QDEL_LIST(events)
return ..()
/datum/musical_event_manager/proc/push_event(datum/sound_player/source, datum/sound_token/token, time, volume)
if (istype(source) && istype(token) && volume >= 0 && volume <= 100)
@@ -51,6 +51,6 @@
. = ..()
/datum/sound_token/instrument/Destroy()
. = ..()
player.unsubscribe(src)
player = null
return ..()
@@ -0,0 +1,4 @@
author: Hellfirejag
delete-after: True
changes:
- bugfix: "Fixed some hard dels related to Destroy() procs triggering in the wrong order of operations."