This behavior is reproducible in Tests too.
For Example, I am running Cocos2d-html5-v2.1
Steps to reproduce:
- From main menu Choose ChipMunk Test. Do not click next, restart or prev menu items. Go back to main menu.
- From main menu of tests, choose click and move test.
- Click at bottom, where menu items prev,restart and next of ChipMunk Test are located. Now nothing abnormal happens. Next goto Main Menu.
- Repeat Steps 1,2,3 but this time in Step 1 Click next and loop through all tests atleast once.
After doing this, in Step 3, you will observe that clicking at the bottom of Click and Move Test takes you to either next,prev or restart callback of ChipMunk Test.
ie as described by John in opening post, the images associated with menu items have been cleared, but menu item of ChipMunk Test, is still (ghost) active.
I tried adding onExit, removeChildByTag(1) in ChipMunkBaseLayer class in ChipMunkTest.js, but this did not remove the ghost menu items, which were added with same tag.
I do not understand why only looping through all chipmunk tests atleast once, is triggering this. Or maybe there are more ways to trigger this behavior as noted by John.
Not only Click and Move, Current Language Test, also displays this behavior.
I think this because replaceScene does not completely remove earlier scene, instead just does a logical pop to newscene (CCDirector.js)
Update: Tested and reproduced same behavior on latest version 2.1.3, which mentioned bugfix on CCNode leaks in release notes.
Is it not a bug, since it is not logged in the bug/issue tracker? http://www.cocos2d-x.org/projects/html5/issues?set_filter=1&tracker_id=1