I run a thread to read our input in win32 console,
and put the string to a list with lock.
I add a call in Application::run() to run a callback function every frame, to make sure the call back run in main thread.
The callback read a line from the list with lock and do like below:
//
<pre>
void CmdHandler(const char* szCmd)
{
const char* c = szCmd;
while (*c != ‘\0’){
if (*c != ‘\t’ && *c!= ‘\n’ &&*c != ’ ') // check is empty
break;
c++;
}
if (*c ‘’)
return; // empty
jsval val;
ScriptingCore::getInstance()->evalString(szText, &val, “cmd”); // crash!
ScriptingCore::log(ScriptingCore::getInstance()>getGlobalContext, 1, &val);> JS_CompileScript every time, the crash call stack is different every time.
};
</pre>
//===
In cocos2dx 2.2, it works very well.
But it crash in a deep call stack in evalString
is there anything I can do to fix it?