CCObject::~CCObject(void) { // if the object is managed, we should remove it // from pool manager if (m_uAutoReleaseCount > 0) { CCPoolManager::sharedPoolManager()->removeObject(this); } // if the object is referenced by Lua engine, remove it CCScriptEngineManager* scriptManager = CCScriptEngineManager::sharedManager(); if ( scriptManager ) { if (m_nLuaID) { CCScriptEngineManager::sharedManager()->getScriptEngine()->removeScriptObjectByCCObject(this); } else { CCScriptEngineProtocol* pEngine = CCScriptEngineManager::sharedManager()->getScriptEngine(); if (pEngine != NULL && pEngine->getScriptType() == kScriptTypeJavascript) { pEngine->removeScriptObjectByCCObject(this); } } } }
CAObject::~CAObject(void) { CAScheduler::unscheduleAllForTarget(this); CC_SAFE_RELEASE(m_pUserObject); if (m_uAutoReleaseCount > 0) { CAPoolManager::sharedPoolManager()->removeObject(this); } CCScriptEngineProtocol* pEngine = CCScriptEngineManager::sharedManager()->getScriptEngine(); if (pEngine != NULL && pEngine->getScriptType() == kScriptTypeJavascript) { pEngine->removeScriptObjectByCCObject(this); } }