Create the stream dynamically in playSoundData(), to avoid a crash (spotted by

salty-horse) when makeWAVStream() deletes it.

svn-id: r46676
This commit is contained in:
Torbjörn Andersson 2009-12-28 15:53:13 +00:00
parent 9f63095688
commit b6ca638180

View File

@ -782,8 +782,8 @@ void Sound::playVoiceData(byte *soundData, uint sound) {
void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint sound, int pan, int vol, bool loop) {
int size = READ_LE_UINT32(soundData + 4);
Common::MemoryReadStream stream(soundData, size);
Audio::AudioStream *sndStream = Audio::makeWAVStream(&stream, true, loop);
Common::MemoryReadStream *stream = new Common::MemoryReadStream(soundData, size);
Audio::AudioStream *sndStream = Audio::makeWAVStream(stream, true, loop);
convertVolume(vol);
convertPan(pan);