issue #175, add retain for CCCallFunc::m_pSelectorTarget

This commit is contained in:
Walzer 2010-09-30 03:57:31 +00:00
parent 6d658b341c
commit 72aee0eace
2 changed files with 12 additions and 0 deletions

View File

@ -269,6 +269,14 @@ namespace cocos2d {
}
bool CCCallFunc::initWithTarget(SelectorProtocol* pSelectorTarget)
{
if (pSelectorTarget)
{
pSelectorTarget->selectorProtocolRetain();
}
if (m_pSelectorTarget)
{
m_pSelectorTarget->selectorProtocolRelease();
}
m_pSelectorTarget = pSelectorTarget;
return true;
}

View File

@ -172,6 +172,10 @@ namespace cocos2d {
}
virtual ~CCCallFunc()
{
if (m_pSelectorTarget)
{
m_pSelectorTarget->selectorProtocolRelease();
}
}
/** creates the action with the callback