The problem is very simple, Imagine the case when someone (by mistake) call “CCObject::autorelease” twice. This simply will access violation whenever that object is going to be deleted because that object is being deleted twice. I guess ObjectPool should be able to handle such cases or at least there should be an assertion. I can think of two possible solutions:
- check for duplicates whenever “void CCAutoreleasePool::addObject(CCObject* pObject)” is called
- add a flag is object is already managed by memory pool to members of all objects.