[Scummvm-git-logs] scummvm master -> 8fec5edba5c63f1581f07e43e63203a8a77618a3

dreammaster noreply at scummvm.org
Sun Jul 26 09:37:17 UTC 2026


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
3b3977a225 AWE: Fix sfx music crash on OpenBSD
59662862d4 AUDIO: assert() on invalid inRate/outRate makeRateConverter() values
8fec5edba5 AWE: Add a mutex around SfxPlayer


Commit: 3b3977a225c302836045b73fbf490c6eb4e2fd96
    https://github.com/scummvm/scummvm/commit/3b3977a225c302836045b73fbf490c6eb4e2fd96
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2026-07-26T19:37:12+10:00

Commit Message:
AWE: Fix sfx music crash on OpenBSD

Starting the game would crash with OpenBSD's pthread implementation,
triggering a "pthread_mutex_destroy on mutex with waiters!" error.

ThreadSanitizer would also catch this, when building with
--enable-tsan on other systems.

Changed paths:
    engines/awe/sound.cpp


diff --git a/engines/awe/sound.cpp b/engines/awe/sound.cpp
index 82b6897c55e..919de93b7e3 100644
--- a/engines/awe/sound.cpp
+++ b/engines/awe/sound.cpp
@@ -38,8 +38,8 @@ void Sound::playMusic(const char *path, int loops) {
 }
 
 void Sound::playSfxMusic(int num) {
-	_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _sfxStream, -1, 255, 0, DisposeAfterUse::YES, true);
 	_sfx->play(_mixer->getOutputRate());
+	_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _sfxStream, -1, 255, 0, DisposeAfterUse::YES, true);
 }
 
 void Sound::playAifcMusic(const char *path, uint32 offset) {


Commit: 59662862d4c08919f34b906e56f33a27bda9870b
    https://github.com/scummvm/scummvm/commit/59662862d4c08919f34b906e56f33a27bda9870b
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2026-07-26T19:37:12+10:00

Commit Message:
AUDIO: assert() on invalid inRate/outRate makeRateConverter() values

In development builds, this helps catching caller issues, like the one
fixed in the AWE engine with commit
2c1f14815809c7272dd4b1b18c7a4f4e4462d227.

Changed paths:
    audio/rate.cpp


diff --git a/audio/rate.cpp b/audio/rate.cpp
index c4f2018360a..581c2d95356 100644
--- a/audio/rate.cpp
+++ b/audio/rate.cpp
@@ -570,6 +570,8 @@ int RateConverter_Impl<inStereo, outStereo, reverseStereo>::convert(AudioStream
 }
 
 RateConverter *makeRateConverter(st_rate_t inRate, st_rate_t outRate, bool inStereo, bool outStereo, bool reverseStereo) {
+	assert(inRate != 0 && outRate != 0);
+
 	if (inStereo) {
 		if (outStereo) {
 			if (reverseStereo)


Commit: 8fec5edba5c63f1581f07e43e63203a8a77618a3
    https://github.com/scummvm/scummvm/commit/8fec5edba5c63f1581f07e43e63203a8a77618a3
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2026-07-26T19:37:12+10:00

Commit Message:
AWE: Add a mutex around SfxPlayer

Suggested by Claude Pro Opus, after feeding previous commit
1d3d5b311829f646008ea0d5d2b8ac97f99a05b8 and its TSan trace.

Assisted-by: Claude Code:claude-opus-4.8

Changed paths:
    engines/awe/sfx_player.cpp
    engines/awe/sfx_player.h


diff --git a/engines/awe/sfx_player.cpp b/engines/awe/sfx_player.cpp
index ee16c77677b..514d64189ba 100644
--- a/engines/awe/sfx_player.cpp
+++ b/engines/awe/sfx_player.cpp
@@ -52,11 +52,13 @@ SfxPlayer::SfxPlayer(Resource *res)
 }
 
 void SfxPlayer::setEventsDelay(uint16 delay) {
+	Common::StackLock lock(_mutex);
 	debugC(kDebugSound, "SfxPlayer::setEventsDelay(%d)", delay);
 	_delay = delay;
 }
 
 void SfxPlayer::loadSfxModule(uint16 resNum, uint16 delay, uint8 pos) {
+	Common::StackLock lock(_mutex);
 	debugC(kDebugSound, "SfxPlayer::loadSfxModule(0x%X, %d, %d)", resNum, delay, pos);
 	MemEntry *me = &_res->_memList[resNum];
 	if (me->status == Resource::STATUS_LOADED && me->type == Resource::RT_MUSIC) {
@@ -100,6 +102,7 @@ void SfxPlayer::prepareInstruments(const uint8 *p) {
 }
 
 void SfxPlayer::play(int rate) {
+	Common::StackLock lock(_mutex);
 	_playing = true;
 	_rate = rate;
 	_samplesLeft = 0;
@@ -174,17 +177,20 @@ void SfxPlayer::mixSamples(int16 *buf, int len) {
 }
 
 void SfxPlayer::readSamples(int16 *buf, int len) {
+	Common::StackLock lock(_mutex);
 	if (_delay != 0) {
 		mixSamples(buf, len / 2);
 	}
 }
 
 void SfxPlayer::start() {
+	Common::StackLock lock(_mutex);
 	debugC(kDebugSound, "SfxPlayer::start()");
 	_sfxMod.curPos = 0;
 }
 
 void SfxPlayer::stop() {
+	Common::StackLock lock(_mutex);
 	debugC(kDebugSound, "SfxPlayer::stop()");
 	_playing = false;
 }
diff --git a/engines/awe/sfx_player.h b/engines/awe/sfx_player.h
index 6b76f58d8fb..a2ac8a0e874 100644
--- a/engines/awe/sfx_player.h
+++ b/engines/awe/sfx_player.h
@@ -23,6 +23,7 @@
 #define AWE_SFX_PLAYER_H
 
 #include "awe/intern.h"
+#include "common/mutex.h"
 
 namespace Awe {
 
@@ -83,6 +84,8 @@ struct SfxPlayer {
 	int _samplesLeft = 0;
 	SfxChannel _channels[NUM_CHANNELS];
 
+	Common::Mutex _mutex;
+
 	SfxPlayer(Resource *res);
 
 	void setEventsDelay(uint16 delay);




More information about the Scummvm-git-logs mailing list