Hello.
I have found bug in CCSpriteBatchNode. When CCSpriteBatchNode is destroyed it doesn’t set NULL for children (like in CCNode). Here is case when i have this kind of situation. My childs are retained so when CCSpriteBatchNode is destroyed childs still have pointer to destroyed CCSpriteBatchNode.
Resulution will be to do the same like in CCNode simply iterate through childs an set batch node to NULL
My destructor look like:
CCSpriteBatchNode::~CCSpriteBatchNode()
{
if(m_pChildren && m_pChildren->count() > 0)
{
CCObject* child;
CCARRAY_FOREACH(m_pChildren, child)
{
CCSprite* pChild = (CCSprite*) child;
if (pChild)
{
pChild->setBatchNode(NULL);
}
}
}
CC_SAFE_RELEASE(m_pobTextureAtlas);
CC_SAFE_RELEASE(m_pobDescendants);
}
Should i make a PR for this? I have this on cocos2dx master branch.
https://github.com/cocos2d/cocos2d-x/blob/master/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp