[Scummvm-git-logs] scummvm master -> 028bc85dc49b4fa77ca9a75c5781add318b63a82
mistydemeo
noreply at scummvm.org
Mon Oct 24 04:56:53 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
028bc85dc4 DIRECTOR: copy sound streams in AudioFileDecoder
Commit: 028bc85dc49b4fa77ca9a75c5781add318b63a82
https://github.com/scummvm/scummvm/commit/028bc85dc49b4fa77ca9a75c5781add318b63a82
Author: Misty De Meo (mistydemeo at gmail.com)
Date: 2022-10-23T21:09:30-07:00
Commit Message:
DIRECTOR: copy sound streams in AudioFileDecoder
It's possible for audio playback to still be underway at the time the
AudioFileDecoder is destroyed. For Mac games, destroying the _macresman
will also destroy the stream, feeing the pointer while it may be read from
in another thread. Copying the audio instead of just fetching the stream
from the MacResMan ensures that new stream will outlive the MacResMan if
necessary.
Fixes https://bugs.scummvm.org/ticket/13881.
Changed paths:
engines/director/sound.cpp
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index d18ce31db83..7b514c7f150 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -801,7 +801,12 @@ Audio::AudioStream *AudioFileDecoder::getAudioStream(bool looping, bool forPuppe
Common::SeekableReadStream *file = nullptr;
if (_macresman->open(filePath)) {
- file = _macresman->getDataFork();
+ // Data has to be copied out instead of using the stream from
+ // getDataFork() directly because it's possible for this audio
+ // to outlive the owning MacResMan, which would otherwise free
+ // the stream while it's still being read from.
+ Common::SeekableReadStream *stream = _macresman->getDataFork();
+ file = stream->readStream(stream->size());
}
if (file == nullptr) {
More information about the Scummvm-git-logs
mailing list