I fixed the problem of evalString(follow [http://www.cocos2d-x.org/forums/20/topics/39565])
The new problem come out.
jsval val;
if (JS_TRUE == ScriptingCore::getInstance()->evalString("cc", &val)){
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
JSString *string = JS_ValueToString(cx, val); // Crash in heapfree**************
if (string) {
JSStringWrapper wrapper(string);
js_log("%s", wrapper.get());
}
}
jsval val;
if (JS_TRUE == ScriptingCore::getInstance()->evalString("cc", &val)){
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
jsval out;
JS_ConvertValue(cx, val, JSTYPE_STRING, &out); // Crash in heapfree**************
JSString *string = JS_ValueToString(cx, out);
if (string) {
JSStringWrapper wrapper(string);
js_log("%s", wrapper.get());
}
}
Can someone tell me what the problem is?
appreciate…