From 850203fc730a0888206e04431425b19fe414e0db Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Mon, 22 Jun 2009 10:16:45 +0000 Subject: Unwinding the call stack before unloading the script svn-id: r41759 --- engines/gob/game_v1.cpp | 3 ++- engines/gob/game_v2.cpp | 3 ++- engines/gob/script.cpp | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index f038c7edc3..1a530fa4f6 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -242,7 +242,8 @@ void Game_v1::playTot(int16 skipPlay) { _vm->_inter->_breakFromLevel = oldBreakFrom; _vm->_scenery->_pCaptureCounter = oldCaptureCounter; - _script->pop(); + if (_script->isLoaded()) + _script->pop(); } void Game_v1::clearCollisions() { diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index ace842f18e..e170a1c9d0 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -293,7 +293,8 @@ void Game_v2::playTot(int16 skipPlay) { _vm->_inter->_breakFromLevel = oldBreakFrom; _vm->_scenery->_pCaptureCounter = oldCaptureCounter; - _script->pop(); + if (_script->isLoaded()) + _script->pop(); } void Game_v2::clearCollisions() { diff --git a/engines/gob/script.cpp b/engines/gob/script.cpp index 7ed27771f3..0ac9d26a9b 100644 --- a/engines/gob/script.cpp +++ b/engines/gob/script.cpp @@ -343,6 +343,9 @@ void Script::unloadTOT() { if (_lomHandle >= 0) _vm->_dataIO->closeData(_lomHandle); + while (!_callStack.empty()) + pop(); + delete[] _totData; _totData = 0; -- cgit v1.2.3