mirror of https://github.com/axmolengine/axmol.git
fixed #146: convert the pointer to NSObject* before HASH_FIND_INT, because we save it as NSObject*, and the saving operation will adjust the value of pointer.
This commit is contained in:
parent
c83678f9b2
commit
be2baff67f
|
@ -202,7 +202,9 @@ void CCActionManager::addAction(cocos2d::CCAction *pAction, CCNode *pTarget, boo
|
|||
assert(pTarget != NULL);
|
||||
|
||||
tHashElement *pElement = NULL;
|
||||
HASH_FIND_INT(m_pTargets, &pTarget, pElement);
|
||||
// we should convert it to NSObject*, because we save it as NSObject*
|
||||
NSObject *tmp = pTarget;
|
||||
HASH_FIND_INT(m_pTargets, &tmp, pElement);
|
||||
if (! pElement)
|
||||
{
|
||||
pElement = (tHashElement*)calloc(sizeof(*pElement), 1);
|
||||
|
@ -212,12 +214,12 @@ void CCActionManager::addAction(cocos2d::CCAction *pAction, CCNode *pTarget, boo
|
|||
HASH_ADD_INT(m_pTargets, target, pElement);
|
||||
}
|
||||
|
||||
actionAllocWithHashElement(pElement);
|
||||
actionAllocWithHashElement(pElement);
|
||||
|
||||
assert(! ccArrayContainsObject(pElement->actions, pAction));
|
||||
ccArrayAppendObject(pElement->actions, pAction);
|
||||
assert(! ccArrayContainsObject(pElement->actions, pAction));
|
||||
ccArrayAppendObject(pElement->actions, pAction);
|
||||
|
||||
pAction->startWithTarget(pTarget);
|
||||
pAction->startWithTarget(pTarget);
|
||||
}
|
||||
|
||||
// remove
|
||||
|
|
Loading…
Reference in New Issue