summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-09-12 20:31:41 +0000
committerrubidium <rubidium@openttd.org>2009-09-12 20:31:41 +0000
commitafc7f576f77d053f991587dfc2b199b10b19575f (patch)
tree308394dfa1232512e852b82d9ad8922f562204c6 /src
parente720d23d86fc9b690550df1758889e36f2be8be5 (diff)
downloadopenttd-afc7f576f77d053f991587dfc2b199b10b19575f.tar.xz
(svn r17515) -Fix [FS#3189]: [Squirrel] In some cases the call stack would not be cleaned up properly during crash handling. Occasionally this causes asserts to be triggered or crashes.
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/squirrel/squirrel/sqvm.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/3rdparty/squirrel/squirrel/sqvm.cpp b/src/3rdparty/squirrel/squirrel/sqvm.cpp
index 720f21297..4a0abc525 100644
--- a/src/3rdparty/squirrel/squirrel/sqvm.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqvm.cpp
@@ -1165,6 +1165,8 @@ bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackb
}
+ /* Store the call stack size, so we can restore that */
+ SQInteger cstksize = _callsstacksize;
SQInteger ret;
try {
SQBool can_suspend = this->_can_suspend;
@@ -1175,6 +1177,7 @@ bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackb
_nnativecalls--;
suspend = false;
+ _callsstacksize = cstksize;
_stackbase = oldstackbase;
_top = oldtop;
@@ -1184,6 +1187,8 @@ bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackb
throw;
}
+ assert(cstksize == _callsstacksize);
+
_nnativecalls--;
suspend = false;
if( ret == SQ_SUSPEND_FLAG) suspend = true;