Fix use-after-free when mobj is removed while still playing sounds

This commit is contained in:
Gustaf Alhäll authored and Alug committed 2025-12-06 19:40:49 +01:00
1 parent f578781418
commit 3bdc745bd1
2 files changed
+8 -1

No files matched your search

+2
View File
@@ -812,6 +812,8 @@ static void P_LoadSectors(UINT8 *data)
ss->tag = SHORT(ms->tag);
ss->flags |= SF_FLIPSPECIAL_FLOOR;
ss->soundorg.thinker.function = (actionf_p1)P_MobjThinker;
}
// set the sky flat num
+6 -1
View File
@@ -772,9 +772,14 @@ void S_UpdateSounds(void)
volume = c->volume; // 8 bits internal volume precision
sep = NORM_SEP;
if (P_MobjWasRemoved(c->origin))
{
// origin was removed, stop the music
S_StopChannel(cnum);
}
// check non-local sounds for distance clipping
// or modify their params
if (c->origin)
else
{
boolean itsUs = false;