cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.24k stars 7.06k forks source link

Report: ActionManager crash (with minimal reproduction and possible fix) #18907

Open rjdgtn opened 6 years ago

rjdgtn commented 6 years ago

Description: Crash after invalidation of iterator elt while iterating in ActionManager::update after delete salvaged target that cause removeAllActionsFromTarget for next element in _targets .

Steps to Reproduce: Look reproduction.txt, just call performCrash and wait a second;

Possible fix: Look: patch.txt Check elt invalidation after remove salvaged item

crazyhappygame commented 6 years ago

Please create pull request with your patch and test case.

rjdgtn commented 6 years ago

I am not sure my fix is best - it's just quick and safe but may occur side effect - if invalidation is happen - some targets will not updated at this frame.