You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When EventDispatcher is in working(flag _inDispatch == 1) and removeEventListener is called:
if (_inDispatch == 0)
{
listeners->erase(iter);
CC_SAFE_RELEASE(l);
}
its mean the listener was not be remove from listeners,until updateListeners to be call 。
In the dispatchTouchEvent member functionc:
sortEventListeners() to cause Gt0Index be set: listeners->setGt0Index(index)
then, updateListeners to call and remove listener that not remove before, so that the size of fixedPriorityListeners is change.
so cause the assert to failed.
CCASSERT(listeners->getGt0Index() <= static_cast<ssize_t>(fixedPriorityListeners->size()), "Out of range exception!"); (line:734)
The text was updated successfully, but these errors were encountered:
There is a _priorityDirtyFlagMap in the CCEventDispatcher.cpp, at the end of dispatchEvent(event), it will called updateListeners(event);
In the updateListeners(event), it will remove the listener whitch is unregistered. But the cocos did not set the dity flag to DirtyFlag::SCENE_GRAPH_PRIORITY or DirtyFlag::FIXED_PRIORITY.
To resolve this bug, I add two sentences to the updateListeners(Event *event):
...
iter = sceneGraphPriorityListeners->erase(iter);
// line (1161)
setDirty(l->getListenerID(), DirtyFlag::SCENE_GRAPH_PRIORITY);
...
iter = fixedPriorityListeners->erase(iter);
// line (1183)
setDirty(l->getListenerID(), DirtyFlag::FIXED_PRIORITY);
...
When EventDispatcher is in working(flag _inDispatch == 1) and removeEventListener is called:
if (_inDispatch == 0)
{
listeners->erase(iter);
CC_SAFE_RELEASE(l);
}
its mean the listener was not be remove from listeners,until updateListeners to be call 。
In the dispatchTouchEvent member functionc:
sortEventListeners() to cause Gt0Index be set: listeners->setGt0Index(index)
then, updateListeners to call and remove listener that not remove before, so that the size of fixedPriorityListeners is change.
so cause the assert to failed.
CCASSERT(listeners->getGt0Index() <= static_cast<ssize_t>(fixedPriorityListeners->size()), "Out of range exception!"); (line:734)
The text was updated successfully, but these errors were encountered: