Fixing bug in CCNode::copy bindings. Fixes MoonWarriors crash

This commit is contained in:
Rohan Kuruvilla 2012-10-23 16:45:40 -07:00 committed by James Chen
parent 1ede7b6434
commit 094d52664d
1 changed files with 1 additions and 0 deletions

View File

@ -509,6 +509,7 @@ JSBool js_cocos2dx_CCNode_copy(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::CCObject *ret = node->copy();
if (ret && jsret) {
JS_NEW_PROXY(proxy, ret, jsret);
JS_AddNamedObjectRoot(cx, &proxy->obj, typeid(*ret).name());
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(jsret));
return JS_TRUE;
}