[Scummvm-cvs-logs] SF.net SVN: scummvm: [23523] scummvm/trunk/engines/sword2/animation.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Thu Jul 20 22:51:59 CEST 2006


Revision: 23523
          http://svn.sourceforge.net/scummvm/?rev=23523&view=rev
Author:   eriktorbjorn
Date:     2006-07-15 15:42:28 -0700 (Sat, 15 Jul 2006)

Log Message:
-----------
Close the current text object when the movie is ended, to avoid potential
memory leak, and be a bit more robust about handling text objects in the dummy
player.

Modified Paths:
--------------
    scummvm/trunk/engines/sword2/animation.cpp

Modified: scummvm/trunk/engines/sword2/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword2/animation.cpp	2006-07-15 22:22:39 UTC (rev 23522)
+++ scummvm/trunk/engines/sword2/animation.cpp	2006-07-15 22:42:28 UTC (rev 23523)
@@ -400,6 +400,9 @@
 		updateScreen();
 	}
 
+	// The current text object may still be open
+	closeTextObject(_textList[_currentText]);
+
 	if (!terminate) {
 		// Wait for the voice to stop playing. This is to make sure
 		// that we don't cut off the speech in mid-sentence, and - even
@@ -782,12 +785,16 @@
 }
 
 void MoviePlayerDummy::drawTextObject(MovieTextObject *t) {
-	_vm->_screen->drawSurface(t->textSprite, _textSurface);
+	if (t->textSprite && _textSurface) {
+		_vm->_screen->drawSurface(t->textSprite, _textSurface);
+	}
 }
 
 void MoviePlayerDummy::undrawTextObject(MovieTextObject *t) {
-	memset(_textSurface, 1, t->textSprite->w * t->textSprite->h);
-	drawTextObject(t);
+	if (t->textSprite && _textSurface) {
+		memset(_textSurface, 1, t->textSprite->w * t->textSprite->h);
+		drawTextObject(t);
+	}
 }
 
 ///////////////////////////////////////////////////////////////////////////////






More information about the Scummvm-git-logs mailing list