diff options
author | Torbjörn Andersson | 2006-07-15 22:42:28 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2006-07-15 22:42:28 +0000 |
commit | c7babbea99d100fe534bacf3f05a94c18be567e6 (patch) | |
tree | 83a27636060147642629440011efb8e5c54566ad /engines | |
parent | 700953cff7b1615b5cc1b36d9db4bdf8b14d2d2d (diff) | |
download | scummvm-rg350-c7babbea99d100fe534bacf3f05a94c18be567e6.tar.gz scummvm-rg350-c7babbea99d100fe534bacf3f05a94c18be567e6.tar.bz2 scummvm-rg350-c7babbea99d100fe534bacf3f05a94c18be567e6.zip |
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.
svn-id: r23523
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sword2/animation.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp index f13ce959c0..20ac26774e 100644 --- a/engines/sword2/animation.cpp +++ b/engines/sword2/animation.cpp @@ -400,6 +400,9 @@ void MoviePlayer::play(int32 leadIn, int32 leadOut) { 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::drawFrame() { } 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); + } } /////////////////////////////////////////////////////////////////////////////// |