mapbox / mapbox-gl-native-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
217 stars 118 forks source link

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

Closed pengdev closed 3 years ago

pengdev commented 3 years ago

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>