[Scummvm-git-logs] scummvm master -> d99194d3494d53775a947ab0b6bdd2f8cd8152f5

sev- noreply at scummvm.org
Mon Sep 2 09:34:49 UTC 2024


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

Summary:
2f0914662a QDENGINE: Got ird of static object in mpegPlayer
d99194d349 QDENGINE: Implemented shortcut logic on stopped sound checks


Commit: 2f0914662a80c31f8a05cf086934486921621a91
    https://github.com/scummvm/scummvm/commit/2f0914662a80c31f8a05cf086934486921621a91
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-02T11:33:13+02:00

Commit Message:
QDENGINE: Got ird of static object in mpegPlayer

Fixes double free on program exit.

Changed paths:
    engines/qdengine/qdcore/util/plaympp_api.cpp


diff --git a/engines/qdengine/qdcore/util/plaympp_api.cpp b/engines/qdengine/qdcore/util/plaympp_api.cpp
index 0e6f384e4c8..ece93b618ba 100644
--- a/engines/qdengine/qdcore/util/plaympp_api.cpp
+++ b/engines/qdengine/qdcore/util/plaympp_api.cpp
@@ -153,9 +153,13 @@ bool mpegPlayer::init_library(void *dsound_device) {
 void mpegPlayer::deinit_library() {
 }
 
+mpegPlayer *g_mpegPlayer = nullptr;
+
 mpegPlayer &mpegPlayer::instance() {
-	static mpegPlayer player;
-	return player;
+	if (!g_mpegPlayer)
+		g_mpegPlayer = new mpegPlayer;
+
+	return *g_mpegPlayer;
 }
 
 void mpegPlayer::syncMusicSettings() {


Commit: d99194d3494d53775a947ab0b6bdd2f8cd8152f5
    https://github.com/scummvm/scummvm/commit/d99194d3494d53775a947ab0b6bdd2f8cd8152f5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-02T11:34:03+02:00

Commit Message:
QDENGINE: Implemented shortcut logic on stopped sound checks

Fixes double free on program exit

Changed paths:
    engines/qdengine/system/sound/snd_sound.cpp
    engines/qdengine/system/sound/snd_sound.h


diff --git a/engines/qdengine/system/sound/snd_sound.cpp b/engines/qdengine/system/sound/snd_sound.cpp
index f7cbefee1cc..722ff71a811 100644
--- a/engines/qdengine/system/sound/snd_sound.cpp
+++ b/engines/qdengine/system/sound/snd_sound.cpp
@@ -76,6 +76,8 @@ bool sndSound::stop() {
 	if (_sound && _sound->_audioStream)
 		_sound->_audioStream->seek(0);
 
+	_isStopped = true;
+
 	return true;
 }
 
@@ -93,6 +95,9 @@ void sndSound::resume() {
 }
 
 sndSound::status_t sndSound::status() const {
+	if (_isStopped)
+		return SOUND_STOPPED;
+
 	if (is_paused())
 		return sndSound::SOUND_PAUSED;
 
diff --git a/engines/qdengine/system/sound/snd_sound.h b/engines/qdengine/system/sound/snd_sound.h
index ee109c07629..196c235f7db 100644
--- a/engines/qdengine/system/sound/snd_sound.h
+++ b/engines/qdengine/system/sound/snd_sound.h
@@ -129,6 +129,8 @@ private:
 	int _flags;
 
 	Audio::SoundHandle _audHandle;
+
+	bool _isStopped = false;
 };
 
 } // namespace QDEngine




More information about the Scummvm-git-logs mailing list