mirror of https://github.com/axmolengine/axmol.git
fixed #1494: Change the value of CCObject::m_uAutoreleaseCount in CCAutoreleasePool class.
This commit is contained in:
parent
54b4c690d1
commit
6d29e63294
|
@ -44,13 +44,16 @@ void CCAutoreleasePool::addObject(CCObject* pObject)
|
|||
m_pManagedObjectArray->addObject(pObject);
|
||||
|
||||
CCAssert(pObject->m_uReference > 1, "reference count should be greater than 1");
|
||||
|
||||
++(pObject->m_uAutoReleaseCount);
|
||||
pObject->release(); // no ref count, in this case autorelease pool added.
|
||||
}
|
||||
|
||||
void CCAutoreleasePool::removeObject(CCObject* pObject)
|
||||
{
|
||||
m_pManagedObjectArray->removeObject(pObject, false);
|
||||
for (int i = 0; i < pObject->m_uAutoReleaseCount; ++i)
|
||||
{
|
||||
m_pManagedObjectArray->removeObject(pObject, false);
|
||||
}
|
||||
}
|
||||
|
||||
void CCAutoreleasePool::clear()
|
||||
|
|
|
@ -53,10 +53,7 @@ CCObject::~CCObject(void)
|
|||
// from pool manager
|
||||
if (m_uAutoReleaseCount > 0)
|
||||
{
|
||||
for (int i = 0; i < m_uAutoReleaseCount; ++i)
|
||||
{
|
||||
CCPoolManager::sharedPoolManager()->removeObject(this);
|
||||
}
|
||||
CCPoolManager::sharedPoolManager()->removeObject(this);
|
||||
}
|
||||
|
||||
// if the object is referenced by Lua engine, remove it
|
||||
|
@ -100,8 +97,6 @@ void CCObject::retain(void)
|
|||
CCObject* CCObject::autorelease(void)
|
||||
{
|
||||
CCPoolManager::sharedPoolManager()->addObject(this);
|
||||
|
||||
++m_uAutoReleaseCount;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue