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
|
@ -172,12 +172,11 @@ void EventDispatcher::removeEventListener(EventListener* listener)
|
||||||
for (auto itemIter = iter->second->begin(); itemIter != iter->second->end(); ++itemIter)
|
for (auto itemIter = iter->second->begin(); itemIter != iter->second->end(); ++itemIter)
|
||||||
{
|
{
|
||||||
if ((*itemIter)->listener == listener)
|
if ((*itemIter)->listener == listener)
|
||||||
{
|
{
|
||||||
listener->retain();
|
(*itemIter)->listener->_isRegistered = false;
|
||||||
|
(*itemIter)->listener->release();
|
||||||
if (_inDispatch == 0)
|
if (_inDispatch == 0)
|
||||||
{
|
{
|
||||||
(*itemIter)->listener->release();
|
|
||||||
delete (*itemIter);
|
delete (*itemIter);
|
||||||
iter->second->erase(itemIter);
|
iter->second->erase(itemIter);
|
||||||
}
|
}
|
||||||
|
@ -207,11 +206,6 @@ void EventDispatcher::removeEventListener(EventListener* listener)
|
||||||
if (isFound)
|
if (isFound)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFound)
|
|
||||||
{
|
|
||||||
listener->release();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventDispatcher::setPriority(EventListener* listener, int fixedPriority)
|
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)
|
for (auto iter = listenerItemIter->second->begin(); iter != listenerItemIter->second->end(); ++iter)
|
||||||
{
|
{
|
||||||
|
(*iter)->listener->_isRegistered = false;
|
||||||
(*iter)->listener->release();
|
(*iter)->listener->release();
|
||||||
if (_inDispatch)
|
if (_inDispatch)
|
||||||
{
|
{
|
||||||
|
@ -637,6 +632,7 @@ void EventDispatcher::removeAllListeners()
|
||||||
{
|
{
|
||||||
for (auto iter = listenerItemIter->second->begin(); iter != listenerItemIter->second->end(); ++iter)
|
for (auto iter = listenerItemIter->second->begin(); iter != listenerItemIter->second->end(); ++iter)
|
||||||
{
|
{
|
||||||
|
(*iter)->listener->_isRegistered = false;
|
||||||
(*iter)->listener->release();
|
(*iter)->listener->release();
|
||||||
if (_inDispatch)
|
if (_inDispatch)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue