[MIRROR] Attempting to fix search_object hard dels (#29167)

* Attempting to fix search_object hard dels (#85394)

## About The Pull Request

![image](https://github.com/user-attachments/assets/b4cd5369-06c4-4e01-98f4-343030e28199)

These were coming up often, had a hunch that the callback may have been
hanging their refs. It seems to be true from my testing, they should be
passing GLOBAL_PROC as the `object` arg, not `src`, since qdel is not a
`search_object` proc. (Thanks Melbert for noticing that detail!)

Also just tidies up the code a bit, adding checks to prevent redundant
qdel calls and preventing a potential race condition with qdeleted
atoms.

## Why It's Good For The Game

Hard dels here in particular have potential to cause significant lag and
issues.

## Changelog

Not player-facing really

* Attempting to fix search_object hard dels

---------

Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
This commit is contained in:
SkyratBot
2024-08-04 17:35:57 +02:00
committed by GitHub
parent 2884dc05d8
commit 9edb55b8b1
2 changed files with 7 additions and 1 deletions

View File

@@ -21,6 +21,8 @@
if(!istype(thing))
stack_trace("Non-atom in the contents of [source_turf]!")
continue
if(QDELETED(thing))
continue
if(thing.mouse_opacity == MOUSE_OPACITY_TRANSPARENT)
continue
if(thing.IsObscured())

View File

@@ -62,6 +62,7 @@
/datum/search_object/Destroy(force)
item = null
icon = null
return ..()
@@ -75,6 +76,9 @@
/datum/search_object/proc/on_item_moved(atom/source)
SIGNAL_HANDLER
if(QDELETED(src))
return
qdel(src)
@@ -82,4 +86,4 @@
/datum/search_object/proc/on_turf_change(turf/source, path, list/new_baseturfs, flags, list/post_change_callbacks)
SIGNAL_HANDLER
post_change_callbacks += CALLBACK(src, GLOBAL_PROC_REF(qdel), src)
post_change_callbacks += CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(qdel), src)