[MIRROR] Fix runtime with chat messages deleting when their clients do [MDB IGNORE] (#21359)

* Fix runtime with chat messages deleting when their clients do (#75445)

```
 -
[2023-05-07 18:56:20.998] runtime error: Del'd before we finished fading, with 30 time left (code/datums/chatmessage.dm:81)
 - proc name:  stack trace (/proc/_stack_trace)
 -   source file: stack_trace.dm,4
 -   usr: Lloyd Moffardi (/mob/dead/observer)
 -   src: null
 -   usr.loc: the floor (113,141,4) (/turf/open/floor/iron)
 -   call stack:
 -  stack trace("Del\'d before we finished fadi...", "code/datums/chatmessage.dm", 81)
 - /datum/chatmessage (/datum/chatmessage): Destroy(0)
 - qdel(/datum/chatmessage (/datum/chatmessage), 0)
 - /datum/chatmessage (/datum/chatmessage): on parent qdel(Avylaar (/client), 1)
 - Avylaar (/client):  SendSignal("parent_qdeleting", /list (/list))
 - Avylaar (/client): Del()
```

In 85% of rounds.

This happens because when the client deletes, the chat message is
deleted with it. However, chat messages want to make sure they're not
being deleted mid-animation. These two requirements clash, because a
client can be deleted at any time during the animation. Moves the check
to only be done when the client isn't being destroyed.

* Fix runtime with chat messages deleting when their clients do

---------

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-05-23 21:20:55 +01:00
committed by GitHub
co-authored by Mothblocks
parent 59fd6a71ed
commit 1f0bf950ed
+6 -4
View File
@@ -77,12 +77,14 @@
INVOKE_ASYNC(src, PROC_REF(generate_image), text, target, owner, language, extra_classes, lifespan)
/datum/chatmessage/Destroy()
if(REALTIMEOFDAY < animate_start + animate_lifespan)
stack_trace("Del'd before we finished fading, with [(animate_start + animate_lifespan) - REALTIMEOFDAY] time left")
if (owned_by)
if (!QDELING(owned_by))
if(REALTIMEOFDAY < animate_start + animate_lifespan)
stack_trace("Del'd before we finished fading, with [(animate_start + animate_lifespan) - REALTIMEOFDAY] time left")
if (owned_by.seen_messages)
LAZYREMOVEASSOC(owned_by.seen_messages, message_loc, src)
owned_by.images.Remove(message)
owned_by = null
message_loc = null
message = null
@@ -360,7 +362,7 @@
#undef CHAT_LAYER_MAX_Z
#undef CHAT_LAYER_Z_STEP
#undef CHAT_MESSAGE_APPROX_LHEIGHT
#undef CHAT_MESSAGE_GRACE_PERIOD
#undef CHAT_MESSAGE_GRACE_PERIOD
#undef CHAT_MESSAGE_EOL_FADE
#undef CHAT_MESSAGE_EXP_DECAY
#undef CHAT_MESSAGE_HEIGHT_DECAY