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
Explicitly remove controls from the map on map unload #6488
Conversation
4b8422d
to
50dcb44
Compare
Sweet, |
It looks like layers have the same problem (untested, just looked at the code) - should the same code be added there too? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I'm more worried about the memory leaks - does this help?
No need, because Lines 797 to 799 in 8108ff9
|
It helps in the example I posted, it doesn't help (measurably) in the actual application I'm working on - which probably just means the problem is somewhere else, probably outside of leaflet. I'll carry on investigating and keep you posted if I find anything else related to leaflet! |
That's good enough for me! 😄 |
Thanks for the quick fix! |
This is a blind attempt (i.e. untested) to fix #6487. A map being destroyed will fire the
unload
event, and any controls from that map can use that event to remove themselves from the map.