From b07b1a5c853668c5eb7e2510f002fdc62663d64f Mon Sep 17 00:00:00 2001 From: "sentry[bot]" <39604003+sentry[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 12:32:49 +0200 Subject: [PATCH] Fix: Prevent addtimer with qdeleted object in MouseEntered (#22557) * Please describe the intent of your changes in a clear fashion. This PR addresses an error where `addtimer` was called with a callback assigned to a `qdeleted` object, specifically observed when `MouseEntered` was triggered on items that self-delete, such as the robotic combitool when dropped. The root cause was that the `QDELETED(src)` check in `/obj/item/MouseEntered` was performed *after* the `addtimer` call. This allowed a timer to be registered for an object that was already marked for deletion. The fix involves moving the `if(QDELETED(src)) return` statement to occur *before* any `addtimer` calls within the `MouseEntered` proc. This ensures that if an item is already deleted, the function returns immediately, preventing the creation of timers bound to invalid objects. * Please make sure that, in the case of mapping changes, you include images of these changes in the PR's description. * Please make sure to mark your PR as wip or review required by making a comment with !wip or !review required * If you include sprites/sounds/... (assets) that you have not created yourself specify the license and original author below. * Ensure that you also credit them in the appropriate location / changelog as specified in the contributor guidelines ### Asset Licenses The following assets that **have not** been created by myself are included in this PR: | Path | Original Author | License | | --- | --- | --- | | icons/example.dmi | ExamplePerson (Example Station) | CC0 | Fixes SERVER-PROD-4F --------- Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com> Co-authored-by: VMSolidus --- code/game/objects/items.dm | 4 ++-- html/changelogs/hellfirejag-combitool-timer-runtime.yml | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 html/changelogs/hellfirejag-combitool-timer-runtime.yml diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 361339ec34b..a98d7e1950c 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -1328,10 +1328,10 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. . = ..() if(in_inventory || in_storage) var/mob/user = usr - if(!(user.client.prefs.toggles_secondary & HIDE_ITEM_TOOLTIPS)) - tip_timer = addtimer(CALLBACK(src, PROC_REF(openTip), location, control, params, user), 8, TIMER_STOPPABLE) if(QDELETED(src)) return + if(!(user.client.prefs.toggles_secondary & HIDE_ITEM_TOOLTIPS)) + tip_timer = addtimer(CALLBACK(src, PROC_REF(openTip), location, control, params, user), 8, TIMER_STOPPABLE) if(!(user.client.prefs.toggles_secondary & SEE_ITEM_OUTLINES)) return var/mob/living/L = user diff --git a/html/changelogs/hellfirejag-combitool-timer-runtime.yml b/html/changelogs/hellfirejag-combitool-timer-runtime.yml new file mode 100644 index 00000000000..8fbb59129e9 --- /dev/null +++ b/html/changelogs/hellfirejag-combitool-timer-runtime.yml @@ -0,0 +1,4 @@ +author: Hellfirejag +delete-after: True +changes: + - bugfix: "Fixed a runtime error on objects caused by timers being created on objects that are already being qdel'ed."