Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Fix the race condition when updating LocationCompoent's position.#703

Merged
pengdev merged 2 commits intomainfrom
peng-fix-location-component-geojson
Sep 24, 2021
Merged

Fix the race condition when updating LocationCompoent's position.#703
pengdev merged 2 commits intomainfrom
peng-fix-location-component-geojson

Conversation

@pengdev
Copy link
Copy Markdown
Member

@pengdev pengdev commented Sep 24, 2021

This PR fixes the race condition when updating LocationCompoent's position.
This PR also adds documentation to the GeoJsonSource#setGeoJson, stating the method is not thread-safe.

When using SymbolLayer and GeoJsonSource backed location puck, there's high frequency
modifications done on the main thread and locationFeature is always re-used (modified)
while being parsed on the worker thread. As the GeoJsonSource#setGeoJson method is not thread-safe,
we should do a deep copy of the location feature before passing setting it to GeoJsonSource.

<changelog>Fix the race condition when updating LocationCompoent's position.</changelog>

@pengdev pengdev self-assigned this Sep 24, 2021
When using SymbolLayer and GeoJsonSource backed location puck, there's high frequency
modifications done on the main thread and locationFeature is always re-used (modified)
while being parsed on the worker thread. As the `setGeoJson` method is not thread-safe,
we should do a deep copy of the location feature before passing setting it to GeoJsonSource.
@pengdev pengdev force-pushed the peng-fix-location-component-geojson branch from 0e7c16f to bec190a Compare September 24, 2021 12:21
@pengdev pengdev merged commit 096a0bd into main Sep 24, 2021
@pengdev pengdev deleted the peng-fix-location-component-geojson branch September 24, 2021 13:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants