(svn r25585) -Fix [FS#5320]: [Squirrel] Stack overflow did not show an error, due to the stack to throw the error already being full
authorrubidium
Thu Jul 11 17:29:51 2013 +0000 (13 months ago)
changeset 20554af6bb5abecbe
parent 20553ad0ae87ef22f
child 20555452d11268945
(svn r25585) -Fix [FS#5320]: [Squirrel] Stack overflow did not show an error, due to the stack to throw the error already being full
src/3rdparty/squirrel/squirrel/sqvm.cpp
src/3rdparty/squirrel/squirrel/sqvm.h
       1 --- a/src/3rdparty/squirrel/squirrel/sqvm.cpp	Wed Jul 10 17:46:54 2013 +0000
       2 +++ b/src/3rdparty/squirrel/squirrel/sqvm.cpp	Thu Jul 11 17:29:51 2013 +0000
       3 @@ -107,6 +107,7 @@
       4  	_errorhandler = _null_;
       5  	_debughook = _null_;
       6  	_can_suspend = false;
       7 +	_in_stackoverflow = false;
       8  	_ops_till_suspend = 0;
       9  	ci = NULL;
      10  	INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this);
     1.1 --- a/src/3rdparty/squirrel/squirrel/sqvm.h	Wed Jul 10 17:46:54 2013 +0000
     1.2 +++ b/src/3rdparty/squirrel/squirrel/sqvm.h	Thu Jul 11 17:29:51 2013 +0000
     1.3 @@ -170,6 +170,7 @@
     1.4  
     1.5  	SQBool _can_suspend;
     1.6  	SQInteger _ops_till_suspend;
     1.7 +	SQBool _in_stackoverflow;
     1.8  
     1.9  	bool ShouldSuspend()
    1.10  	{
    1.11 @@ -200,8 +201,10 @@
    1.12  
    1.13  #define PUSH_CALLINFO(v,nci){ \
    1.14  	if(v->_callsstacksize == v->_alloccallsstacksize) { \
    1.15 -		if (v->_callsstacksize > 65535) {\
    1.16 +		if (v->_callsstacksize > 65535 && !v->_in_stackoverflow) {\
    1.17 +			v->_in_stackoverflow = true; \
    1.18  			v->Raise_Error(_SC("stack overflow"));\
    1.19 +			v->CallErrorHandler(v->_lasterror);\
    1.20  			return false;\
    1.21  		}\
    1.22  		v->GrowCallStack(); \