issue #64: retain the object when it was added to the scheduler

This commit is contained in:
Ming 2010-08-20 07:56:24 +00:00
parent 2a37efc84a
commit 19b75463ed
1 changed files with 4 additions and 0 deletions

View File

@ -209,6 +209,10 @@ void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol *p
{ {
pElement = (tHashSelectorEntry *)calloc(sizeof(*pElement), 1);; pElement = (tHashSelectorEntry *)calloc(sizeof(*pElement), 1);;
pElement->target = pTarget; pElement->target = pTarget;
if (pTarget)
{
dynamic_cast<NSObject*>(pTarget)->retain();
}
HASH_ADD_INT(m_pHashForSelectors, target, pElement); HASH_ADD_INT(m_pHashForSelectors, target, pElement);
// Is this the 1st element ? Then set the pause level to all the selectors of this target // Is this the 1st element ? Then set the pause level to all the selectors of this target