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
@@ -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 ..()