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

Removing a symbol layer and immediately readding it as a circle layer causes TypeError in draw_circle #3633

Closed
anandthakker opened this issue Nov 16, 2016 · 3 comments
Labels

Comments

@anandthakker
Copy link
Contributor

mapbox-gl-js version: 0.27

Steps to Trigger Behavior

  1. Create a map with a symbol layer with id 'a'
  2. map.removeLayer('a'); map.addLayer({ id: 'a', type: 'circle', source: (same as the symbol layer) })

Expected Behavior

There are no errors

Actual Behavior

TypeError: Cannot read property 'circle' of undefined
    at Object.drawCircles [as circle] (/Users/anand/c/mapbox/mapbox-gl-js/js/render/draw_circle.js:27:44)
    at Painter.renderLayer (/Users/anand/c/mapbox/mapbox-gl-js/js/render/painter.js:271:25)
    at Painter.renderPass (/Users/anand/c/mapbox/mapbox-gl-js/js/render/painter.js:254:18)
    at Painter.render (/Users/anand/c/mapbox/mapbox-gl-js/js/render/painter.js:213:14)
    at Map._render (/Users/anand/c/mapbox/mapbox-gl-js/js/ui/map.js:1141:22)
    at Immediate.immediate._onImmediate (timers.js:585:18)
    at tryOnImmediate (timers.js:543:15)
    at processImmediate [as _immediateCallback] (timers.js:523:5)

I think the problem is that, since this is happening in a single batch, the it's being treated by the source cache as an update--specifically, the tiles' states are set to reloading, so that they are still considered renderable. In the render pass that happens after the layer's been re-added but before the tile reloading is complete, we end up trying to render them as a circle-layer tiles, but the buffers aren't set up for that yet.

@anandthakker
Copy link
Contributor Author

@jfirebaugh found this while adding a runtime-styling test for setStyle (changing a layer's type) -- do you think this should block #3621, or be left as a follow-up? (In the latter case, I could add an ignore for js pointing to this issue.)

@jfirebaugh
Copy link
Contributor

This sort of situation will be more common with #3621, so let's fix it first.

@anandthakker
Copy link
Contributor Author

👍 sounds good.

On Wed, Nov 16, 2016 at 2:18 PM John Firebaugh notifications@github.com
wrote:

This sort of situation will be more common with #3621
#3621, so let's fix it first.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#3633 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEvmR3hvDieUDhivyyoHasCa3LmkPW01ks5q-4E0gaJpZM4K0Z-w
.

anandthakker pushed a commit that referenced this issue Nov 17, 2016
Fixes #3633 by distinguishing the cases where the source tiles need to
be _reloaded_ from those where they need to be _cleared_
anandthakker pushed a commit to mapbox/mapbox-gl-test-suite that referenced this issue Nov 18, 2016
anandthakker pushed a commit that referenced this issue Nov 18, 2016
Fixes #3633 by distinguishing the cases where the source tiles need to
be _reloaded_ from those where they need to be _cleared_
lucaswoj pushed a commit that referenced this issue Nov 21, 2016
Fixes #3633 by distinguishing the cases where the source tiles need to
be _reloaded_ from those where they need to be _cleared_
jfirebaugh pushed a commit to mapbox/mapbox-gl-test-suite that referenced this issue Nov 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants