diff options
author | Igor Tarasov <igor.tarasov@mapbox.com> | 2019-09-19 15:47:52 +0300 |
---|---|---|
committer | Igor Tarasov <igor.tarasov@mapbox.com> | 2019-09-19 15:47:52 +0300 |
commit | 7b5264ebd7e9ad639af778d979b9edae6f903980 (patch) | |
tree | 408e47edcf9adddc65dc9fdd1be4a7f524b9d658 | |
parent | 93060be3feeb2d4af141b2518a3073da1164f356 (diff) | |
download | qtlocation-mapboxgl-7b5264ebd7e9ad639af778d979b9edae6f903980.tar.gz |
[android] For now, lets ignore the issue in GeoJsonSource's async methods.
-rw-r--r-- | platform/android/src/style/sources/geojson_source.cpp | 6 | ||||
-rw-r--r-- | platform/android/src/style/sources/source.hpp | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/platform/android/src/style/sources/geojson_source.cpp b/platform/android/src/style/sources/geojson_source.cpp index aa05f9c912..6bfdaca1fc 100644 --- a/platform/android/src/style/sources/geojson_source.cpp +++ b/platform/android/src/style/sources/geojson_source.cpp @@ -183,7 +183,11 @@ namespace android { android::UniqueEnv _env = android::AttachEnv(); // Update the core source - source(*_env)->as<mbgl::style::GeoJSONSource>()->GeoJSONSource::setGeoJSON(geoJSON); + auto coreSource = source(); + if (!coreSource) { + return; + } + coreSource->as<mbgl::style::GeoJSONSource>()->GeoJSONSource::setGeoJSON(geoJSON); // if there is an awaiting update, execute it, otherwise, release resources if (awaitingUpdate) { diff --git a/platform/android/src/style/sources/source.hpp b/platform/android/src/style/sources/source.hpp index 3da8840630..e7fd64c656 100644 --- a/platform/android/src/style/sources/source.hpp +++ b/platform/android/src/style/sources/source.hpp @@ -64,6 +64,14 @@ protected: return nonOwnedSource_.get(); } + inline mbgl::style::Source* source() { + if (ownedSource_) return ownedSource_.get(); + if (!nonOwnedSource_) { + return nullptr; + } + return nonOwnedSource_.get(); + } + // Set when the source is added to a map. jni::Global<jni::Object<Source>> javaPeer; |