COMPOSER: Don't delete pipe streams too early.

This commit is contained in:
Alyssa Milburn 2011-11-05 18:33:52 +01:00
parent 21fa7bda57
commit 5e2ab1d050
3 changed files with 7 additions and 1 deletions

View File

@ -186,6 +186,7 @@ private:
Common::Array<QueuedScript> _queuedScripts;
Common::List<Animation *> _anims;
Common::List<Pipe *> _pipes;
Common::Array<Common::SeekableReadStream *> _pipeStreams;
Common::HashMap<uint16, Common::Array<RandomEvent> > _randomEvents;

View File

@ -123,6 +123,7 @@ void ComposerEngine::playAnimation(uint16 animId, int16 x, int16 y, int16 eventP
// If the resource is a pipe itself, then load the pipe
// and then fish the requested animation out of it.
if (type != 1) {
_pipeStreams.push_back(stream);
newPipe = new Pipe(stream);
_pipes.push_front(newPipe);
newPipe->nextFrame();
@ -397,6 +398,11 @@ void ComposerEngine::stopPipes() {
}
_pipes.clear();
// substreams may need to remain valid until the end of a page
for (uint i = 0; i < _pipeStreams.size(); i++)
delete _pipeStreams[i];
_pipeStreams.clear();
}
bool ComposerEngine::spriteVisible(uint16 id, uint16 animId) {

View File

@ -255,7 +255,6 @@ Pipe::Pipe(Common::SeekableReadStream *stream) {
}
Pipe::~Pipe() {
delete _stream;
}
void Pipe::nextFrame() {