From 5237f528b4b5a21992962a658c38818e5291651e Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Thu, 22 Feb 2024 16:57:08 +0100 Subject: [PATCH] [MIRROR] Fixes CI runtime/race condition with forensics (#26606) * Fixes CI runtime/race condition with forensics (#81610) ## About The Pull Request Just a quick fix for the following CI runtime, and additionally passes through the rest of this file's weakref instances for any other potential bugs. ![image](https://github.com/tgstation/tgstation/assets/13398309/a58be18a-21e4-40b2-92e0-1a961108c939) ## Why It's Good For The Game Bugfix ## Changelog Nothing player facing --------- Co-authored-by: san7890 * Fixes CI runtime/race condition with forensics --------- Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> Co-authored-by: san7890 --- code/modules/forensics/_forensics.dm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/code/modules/forensics/_forensics.dm b/code/modules/forensics/_forensics.dm index 6a06e549d26359..40b480182537e1 100644 --- a/code/modules/forensics/_forensics.dm +++ b/code/modules/forensics/_forensics.dm @@ -70,6 +70,7 @@ var/atom/parent_atom = parent.resolve() if (!isnull(parent_atom)) UnregisterSignal(parent_atom, list(COMSIG_COMPONENT_CLEAN_ACT)) + parent = null return ..() /// Empties the fingerprints list @@ -147,7 +148,9 @@ /// Adds a single fiber /datum/forensics/proc/add_fibers(mob/living/carbon/human/suspect) var/fibertext - var/atom/actual_parent = parent.resolve() + var/atom/actual_parent = parent?.resolve() + if(isnull(actual_parent)) + parent = null var/item_multiplier = isitem(actual_parent) ? ITEM_FIBER_MULTIPLIER : NON_ITEM_FIBER_MULTIPLIER if(suspect.wear_suit) fibertext = "Material from \a [suspect.wear_suit]." @@ -214,8 +217,11 @@ if(last_stamp_pos) LAZYSET(hiddenprints, suspect.key, copytext(hiddenprints[suspect.key], 1, last_stamp_pos)) hiddenprints[suspect.key] += "\nLast: \[[current_time]\] \"[suspect.real_name]\"[has_gloves]. Ckey: [suspect.ckey]" //made sure to be existing by if(!LAZYACCESS);else - var/atom/parent_atom = parent.resolve() - parent_atom.fingerprintslast = suspect.ckey + var/atom/parent_atom = parent?.resolve() + if(!isnull(parent_atom)) + parent_atom.fingerprintslast = suspect.ckey + else + parent = null return TRUE /// Adds the given list into blood_DNA @@ -230,7 +236,10 @@ /// Updates the blood displayed on parent /datum/forensics/proc/check_blood() - var/obj/item/the_thing = parent.resolve() + var/obj/item/the_thing = parent?.resolve() + if(isnull(the_thing)) + parent = null + return if(!istype(the_thing) || isorgan(the_thing)) // organs don't spawn with blood decals by default return if(!length(blood_DNA))