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

_project called on removed layer in canvas renderer #5097

Closed
perliedman opened this issue Nov 14, 2016 · 1 comment · Fixed by #5115
Closed

_project called on removed layer in canvas renderer #5097

perliedman opened this issue Nov 14, 2016 · 1 comment · Fixed by #5115
Assignees

Comments

@perliedman
Copy link
Member

While looking at #5093, I discovered that current master has a problem when layers are removed from the canvas renderer.

When removing a layer, the removed layer's _project method is sometimes called even though it's removed, causing an exception since the layer's this._map is not set.

Example is this modified playground from #5093: http://playground-leaflet.rhcloud.com/firu/edit?html,output

Click the map twice, the second time you will get an exception and the map will not update properly.

I believe the problem lies in the _requestRedraw's asynchronous behaviour: in this particular case, the redraw is postponed until after the fitBounds call, so the layer has not yet been removed from the renderer's _layers (this is done in draw when the clearflag is set).

I believe this is caused by the refactor in #5054.

@perliedman
Copy link
Member Author

I'm in the process of addressing this issue over here: https://github.com/perliedman/leaflet/tree/wip-canvas-clear

This involves a bit more refactoring of the canvas rendering, so we'll have to test this somewhat thoroughly before merging.

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

Successfully merging a pull request may close this issue.

2 participants