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

Null pointer issues seemingly related to race conditions in layer removal #2484

Closed
AndyMoreland opened this issue Apr 21, 2016 · 1 comment · Fixed by #2497
Closed

Null pointer issues seemingly related to race conditions in layer removal #2484

AndyMoreland opened this issue Apr 21, 2016 · 1 comment · Fixed by #2497

Comments

@AndyMoreland
Copy link
Contributor

AndyMoreland commented Apr 21, 2016

mapbox-gl-js version: v0.17.0

Steps to Trigger Behavior

  1. remove a geojson sourced layer very soon after it was added

Problem: Bucket.create fails while invoking Classes[options.layer.type]: options.layer is undefined in this context.

The stack is:

Bucket.create:mapbox-gl-dev.js:24
unserializeBuckets:mapbox-gl-dev.js:5733
Tile.loadVectorData:mapbox-gl-dev.js:6520
(anonymous function):mapbox-gl-dev.js:4957
Actor.receive:mapbox-gl-dev.js:14657

The problem is that is that data.buckets in Tile.loadVectorData references the layerId of a layer that has already had removeLayer invoked on it, so it's not present in style._layers.

@AndyMoreland
Copy link
Contributor Author

My quick and dirty fix for my fork is to do:

+        if (input[i].layerId && !style.getLayer(input[i].layerId)) {
+            continue;
+        }
+

in the inner loop of unserializeBuckets in tile.js.

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