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

Item remove or event handler set to null may cause mouse events to cease working. #2079

Open
ppieczul opened this issue Jun 11, 2024 · 0 comments

Comments

@ppieczul
Copy link

item.remove() or item.onMouse..... = null does not check if item is included in the project and always decrements the item event handler counters (_itemEvents).
When item is part of a group, and that group is removed, and later this item is removed, the counters will go below zero.
When counters go below zero, on subsequent correct registration of the event handlers, the counters will be incremented, but eventually, they will reach zero. If that happens, events will stop working.

The workaround is to always check if item isInserted() below calling remove or setting handlers to null.
I think however, than these functions should be safe to call even if item is not in the project, and should never cause internal incoherency that later has unexpected consequences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant