uses proxy instead of Get/SetPrivate

This commit is contained in:
Rolando Abarca 2012-07-19 12:17:24 -07:00 committed by folecr
parent 0e9ba1173a
commit 42ce395f05
1 changed files with 7 additions and 5 deletions

View File

@ -67,13 +67,15 @@ CCObject::~CCObject(void)
CCScriptEngineManager::sharedManager()->getScriptEngine()->removeCCObjectByID(m_nLuaID);
}
#ifdef COCOS2D_JAVASCRIPT
js_proxy_t* p;
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
void *ptr = this;
JS_GET_PROXY(p, ptr);
if (p) {
JS_GET_PROXY(nproxy, ptr);
if (nproxy) {
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
JS_SetPrivate(p->obj, NULL);
JS_RemoveObjectRoot(cx, &p->obj);
JS_RemoveObjectRoot(cx, &nproxy->obj);
JS_GET_NATIVE_PROXY(jsproxy, nproxy->obj);
JS_REMOVE_PROXY(nproxy, jsproxy);
}
#endif
}