Merge commit 'refs/pull/4069/head' of git://github.com/cocos2d/cocos2d-x into eventdispatcher-fix

This commit is contained in:
James Chen 2013-11-02 21:47:24 +08:00
commit a4b28353a7
1 changed files with 9 additions and 2 deletions

View File

@ -442,9 +442,16 @@ void EventDispatcher::removeEventListener(EventListener* listener)
break;
}
if (isFound)
{
if (isFound) {
CC_SAFE_RELEASE(listener);
} else {
for(auto iter=_toAddedListeners.begin(); iter != _toAddedListeners.end(); ++iter) {
if ((*iter)->listener == listener)
{
_toAddedListeners.erase(iter);
break;
}
}
}
}