mirror of https://github.com/axmolengine/axmol.git
issue #2087: Bug fix in EventDispatcher: _isRegister fix.
This commit is contained in:
parent
8fa969b39e
commit
3985574c30
|
@ -173,11 +173,10 @@ void EventDispatcher::removeEventListener(EventListener* listener)
|
|||
{
|
||||
if ((*itemIter)->listener == listener)
|
||||
{
|
||||
listener->retain();
|
||||
|
||||
(*itemIter)->listener->_isRegistered = false;
|
||||
(*itemIter)->listener->release();
|
||||
if (_inDispatch == 0)
|
||||
{
|
||||
(*itemIter)->listener->release();
|
||||
delete (*itemIter);
|
||||
iter->second->erase(itemIter);
|
||||
}
|
||||
|
@ -207,11 +206,6 @@ void EventDispatcher::removeEventListener(EventListener* listener)
|
|||
if (isFound)
|
||||
break;
|
||||
}
|
||||
|
||||
if (isFound)
|
||||
{
|
||||
listener->release();
|
||||
}
|
||||
}
|
||||
|
||||
void EventDispatcher::setPriority(EventListener* listener, int fixedPriority)
|
||||
|
@ -610,6 +604,7 @@ void EventDispatcher::removeListenersForEventType(const std::string& eventType)
|
|||
{
|
||||
for (auto iter = listenerItemIter->second->begin(); iter != listenerItemIter->second->end(); ++iter)
|
||||
{
|
||||
(*iter)->listener->_isRegistered = false;
|
||||
(*iter)->listener->release();
|
||||
if (_inDispatch)
|
||||
{
|
||||
|
@ -637,6 +632,7 @@ void EventDispatcher::removeAllListeners()
|
|||
{
|
||||
for (auto iter = listenerItemIter->second->begin(); iter != listenerItemIter->second->end(); ++iter)
|
||||
{
|
||||
(*iter)->listener->_isRegistered = false;
|
||||
(*iter)->listener->release();
|
||||
if (_inDispatch)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue