Moves deletion for dreamluau objects to happen at the very end of the Destroy proc. (#86066)

## About The Pull Request
As the title says

## Why It's Good For The Game
Dreamluau objects should only really be nulled out right before deletion
handling is complete, since it makes logical sense for lua to have a
handle on these objects up until they're queued for deletion. It's
slightly different from weakrefs in the fact that a weakref is not going
to handle signals, but a lua script can, so it makes sense for the
nulling out to happen after ECS cleanup is complete.

No changelog necessary since it's not fixing any particular bug

Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
This commit is contained in:
Watermelon914
2024-09-04 21:55:38 -04:00
committed by GitHub
co-authored by Watermelon914
parent 0b18f165d8
commit 68d182b576
+4 -3
View File
@@ -111,9 +111,6 @@
tag = null
datum_flags &= ~DF_USE_TAG //In case something tries to REF us
weak_reference = null //ensure prompt GCing of weakref.
if(!(datum_flags & DF_STATIC_OBJECT))
DREAMLUAU_CLEAR_REF_USERDATA(vars) // vars ceases existing when src does, so we need to clear any lua refs to it that exist.
DREAMLUAU_CLEAR_REF_USERDATA(src)
if(_active_timers)
var/list/timers = _active_timers
@@ -145,6 +142,10 @@
_clear_signal_refs()
//END: ECS SHIT
if(!(datum_flags & DF_STATIC_OBJECT))
DREAMLUAU_CLEAR_REF_USERDATA(vars) // vars ceases existing when src does, so we need to clear any lua refs to it that exist.
DREAMLUAU_CLEAR_REF_USERDATA(src)
return QDEL_HINT_QUEUE
///Only override this if you know what you're doing. You do not know what you're doing