Famous / engine

MIT License
1.75k stars 250 forks source link

FamousEngine->removeScene does not recursively remove all child and grandchild nodes #452

Open arunabhdas opened 9 years ago

arunabhdas commented 9 years ago

It is expected that removeScene would do a depth-first search and remove all child and grandchild nodes but it doesn't seem to do this. The child and grandchild nodes continue to remain.

mickewi commented 9 years ago

I'm running into the same issue when doing dismount() on my root node and then try to mount new nodes.

It basically boils down to this:

var aTreeWithNodes = createTree();
famousScene.addChild(aTreeWithNodes);
aTreeWithNodes.dismount();
famousScene.addChild(createTree()); //add a fresh set of nodes -> BAM

I'm getting an error in the PathStore. Seems like the memo is correctly cleared, but according to the paths array all the children of the rootNode are still there.

Doing a manual recursive depth-first dismount() solves the issue for me.