mirror of https://github.com/axmolengine/axmol.git
[wophone]Resolve the memory leak of CCAccelerometer.
This commit is contained in:
parent
6d028007c2
commit
dd675f8cf1
|
@ -147,6 +147,22 @@ void CCAccelerometer::removeDelegate(CCAccelerometerDelegate* pDelegate)
|
|||
|
||||
void CCAccelerometer::addDelegate(CCAccelerometerDelegate* pDelegate)
|
||||
{
|
||||
CCAccelerometerHandler *pHandlerIter;
|
||||
CCMutableArray<CCAccelerometerHandler*>::CCMutableArrayIterator iter;
|
||||
|
||||
if (pDelegate)
|
||||
{
|
||||
for (iter = m_pDelegates->begin(); iter != m_pDelegates->end(); ++iter)
|
||||
{
|
||||
pHandlerIter = *iter;
|
||||
if (pHandlerIter && pHandlerIter->getDelegate() == pDelegate)
|
||||
{
|
||||
// this delegate have existed
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CCAccelerometerHandler* pHandler = CCAccelerometerHandler::handlerWithDelegate(pDelegate);
|
||||
|
||||
if (pHandler)
|
||||
|
|
|
@ -978,12 +978,7 @@ void CCSprite::setDisplayFrame(CCSpriteFrame *pNewFrame)
|
|||
|
||||
CCTexture2D *pNewTexture = pNewFrame->getTexture();
|
||||
// update texture before updating texture rect
|
||||
if ((pNewTexture && m_pobTexture) &&
|
||||
(pNewTexture->getName() == m_pobTexture->getName()))
|
||||
{
|
||||
// new texture is same with the current texture,nothing to do
|
||||
}
|
||||
else
|
||||
if (pNewTexture != m_pobTexture)
|
||||
{
|
||||
setTexture(pNewTexture);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue