Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding object to multiple containers causes instability with remove and removeChildren #426

Closed
greggg230 opened this issue May 3, 2013 · 2 comments

Comments

@greggg230
Copy link

See: http://jsfiddle.net/jEtbU/1/

Clicking "break" will cause the page to freeze. I believe this is because the remove method only removes the object from its parent, which is determined by which object it was added to first. In other words, if you add an object to both a group and a layer (in that order) and then call object.remove(), it will remove the object from the group but not the layer. When a method like draw is called on layer, it will run through its children, find object and then throw an error because object.parent is now null.

Adding an object to multiple containers might just be a bad idea, but at the very least it should raise an exception when you try to do it - a bug like this took awhile to track down.

@ericdrowell
Copy link
Owner

I'll add this to my todo list, although it's a bit lower in priority than most of the other items on the list. Thanks!!

@ericdrowell
Copy link
Owner

on second though, this is a pretty easy change. I'll try and have this fixed by the next release, or the following release. I just need to check if the node has a parent when adding it to a container. If it does, automatically run remove() :)

@lavrton lavrton closed this as completed in 74060ce Mar 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants