(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.

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
rubidium 15 years ago
parent e720d23d86
commit afc7f576f7

@ -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;

Loading…
Cancel
Save