mirror of https://github.com/axmolengine/axmol.git
Merge pull request #6157 from dbaack/remove_event_listener_fix
closed #4700: Removing and re-adding an event listener will trigger an assert.
This commit is contained in:
commit
7142dcfce3
|
@ -637,6 +637,7 @@ void EventDispatcher::removeEventListener(EventListener* listener)
|
|||
{
|
||||
if (*iter == listener)
|
||||
{
|
||||
listener->setRegistered(false);
|
||||
listener->release();
|
||||
_toAddedListeners.erase(iter);
|
||||
break;
|
||||
|
@ -1252,6 +1253,7 @@ void EventDispatcher::removeEventListenersForListenerID(const EventListener::Lis
|
|||
{
|
||||
if ((*iter)->getListenerID() == listenerID)
|
||||
{
|
||||
(*iter)->setRegistered(false);
|
||||
(*iter)->release();
|
||||
iter = _toAddedListeners.erase(iter);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue