mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
(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.
This commit is contained in:
parent
e720d23d86
commit
afc7f576f7
5
src/3rdparty/squirrel/squirrel/sqvm.cpp
vendored
5
src/3rdparty/squirrel/squirrel/sqvm.cpp
vendored
@ -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;
|
SQInteger ret;
|
||||||
try {
|
try {
|
||||||
SQBool can_suspend = this->_can_suspend;
|
SQBool can_suspend = this->_can_suspend;
|
||||||
@ -1175,6 +1177,7 @@ bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackb
|
|||||||
_nnativecalls--;
|
_nnativecalls--;
|
||||||
suspend = false;
|
suspend = false;
|
||||||
|
|
||||||
|
_callsstacksize = cstksize;
|
||||||
_stackbase = oldstackbase;
|
_stackbase = oldstackbase;
|
||||||
_top = oldtop;
|
_top = oldtop;
|
||||||
|
|
||||||
@ -1184,6 +1187,8 @@ bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackb
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(cstksize == _callsstacksize);
|
||||||
|
|
||||||
_nnativecalls--;
|
_nnativecalls--;
|
||||||
suspend = false;
|
suspend = false;
|
||||||
if( ret == SQ_SUSPEND_FLAG) suspend = true;
|
if( ret == SQ_SUSPEND_FLAG) suspend = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user