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:45:27 +01:00
1 parent 3818b9ad1a
commit 82b774b2c3
3 files changed
+8 -3

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
@@ -771,9 +771,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;
-2
View File
@@ -1001,7 +1001,6 @@ INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, /*UINT8 pitch, UINT8 prio
{
//(void)channel; // ignore this - we do mixing ourselves so we don't need it
//(void)priority; // priority and channel management is handled by SRB2...
//(void)pitch; // TODO (we can do this now with SDL3)
if (S_sfx[id].data == NULL)
return -1;
@@ -1074,7 +1073,6 @@ boolean I_SoundIsPlaying(INT32 handle)
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep/*, UINT8 pitch*/)
{
//(void)pitch; // TODO
if (handle == -1)
return;