Merge pull request #1414 from walzer/gles20

fixed #1492, assert if user add an CCObject* into CCAutoreleasePool twice.
This commit is contained in:
Walzer 2012-09-28 03:23:17 -07:00
commit 586f5100de
2 changed files with 5 additions and 5 deletions

View File

@ -41,6 +41,8 @@ CCAutoreleasePool::~CCAutoreleasePool(void)
void CCAutoreleasePool::addObject(CCObject* pObject)
{
CCAssert(false == pObject->m_bManaged, "this object is already in autorelese pool");
m_pManagedObjectArray->addObject(pObject);
CCAssert(pObject->m_uReference > 1, "reference count should be greater than 1");

View File

@ -38,15 +38,13 @@ CCObject* CCCopying::copyWithZone(CCZone *pZone)
}
CCObject::CCObject(void)
:m_bManaged(false)
,m_uReference(1) // when the object is created, the reference count of it is 1
,m_nLuaID(0)
{
static unsigned int uObjectCount = 0;
m_uID = ++uObjectCount;
m_nLuaID = 0;
// when the object is created, the reference count of it is 1
m_uReference = 1;
m_bManaged = false;
}
CCObject::~CCObject(void)