mirror of https://github.com/axmolengine/axmol.git
Small dangling pointer tweak/fix to CCEventDispatcher
If cleaning a target node that has a listener in the 'to be added' listeners list then ensure that listener does not have a stale reference to the node. This is a minor tweak in addition to pull request 6160 (https://github.com/cocos2d/cocos2d-x/pull/6160).
This commit is contained in:
parent
6208943cb1
commit
0082900d10
|
@ -351,6 +351,7 @@ void EventDispatcher::removeEventListenersForTarget(Node* target, bool recursive
|
|||
|
||||
if (listener->getSceneGraphPriority() == target)
|
||||
{
|
||||
listener->setSceneGraphPriority(nullptr); // Ensure no dangling ptr to the target node.
|
||||
listener->setRegistered(false);
|
||||
listener->release();
|
||||
iter = _toAddedListeners.erase(iter);
|
||||
|
|
Loading…
Reference in New Issue