[Scummvm-cvs-logs] scummvm master -> 5e2ab1d05073058628dabd2826f60b72154da8b4

fuzzie fuzzie at fuzzie.org
Sat Nov 5 18:35:12 CET 2011


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:
5e2ab1d050 COMPOSER: Don't delete pipe streams too early.


Commit: 5e2ab1d05073058628dabd2826f60b72154da8b4
    https://github.com/scummvm/scummvm/commit/5e2ab1d05073058628dabd2826f60b72154da8b4
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-11-05T10:33:52-07:00

Commit Message:
COMPOSER: Don't delete pipe streams too early.

Changed paths:
    engines/composer/composer.h
    engines/composer/graphics.cpp
    engines/composer/resource.cpp



diff --git a/engines/composer/composer.h b/engines/composer/composer.h
index cebe977..0f53258 100644
--- a/engines/composer/composer.h
+++ b/engines/composer/composer.h
@@ -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;
 
diff --git a/engines/composer/graphics.cpp b/engines/composer/graphics.cpp
index 42d0a20..1314e90 100644
--- a/engines/composer/graphics.cpp
+++ b/engines/composer/graphics.cpp
@@ -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) {
diff --git a/engines/composer/resource.cpp b/engines/composer/resource.cpp
index 6d7f2f2..a4e2927 100644
--- a/engines/composer/resource.cpp
+++ b/engines/composer/resource.cpp
@@ -255,7 +255,6 @@ Pipe::Pipe(Common::SeekableReadStream *stream) {
 }
 
 Pipe::~Pipe() {
-	delete _stream;
 }
 
 void Pipe::nextFrame() {






More information about the Scummvm-git-logs mailing list