summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2018-09-04 09:36:57 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2018-09-04 11:21:32 -0700
commitfab0132d1f531906d5177bc0304c5da379b7fea1 (patch)
tree601706ac6e604b6bd66e83317c6a714f62d7f516
parent71676f3448a614255eabd31a46474116b5639fa8 (diff)
downloadqtlocation-mapboxgl-upstream/backport-12810.tar.gz
Retain a shared thread pool referenceupstream/backport-12810
Otherwise it may be prematurely deleted.
-rw-r--r--platform/android/src/style/sources/geojson_source.cpp10
-rw-r--r--platform/android/src/style/sources/geojson_source.hpp1
2 files changed, 7 insertions, 4 deletions
diff --git a/platform/android/src/style/sources/geojson_source.cpp b/platform/android/src/style/sources/geojson_source.cpp
index e526231763..9d6ca704eb 100644
--- a/platform/android/src/style/sources/geojson_source.cpp
+++ b/platform/android/src/style/sources/geojson_source.cpp
@@ -45,15 +45,17 @@ namespace android {
GeoJSONSource::GeoJSONSource(jni::JNIEnv& env, jni::String sourceId, jni::Object<> options)
: Source(env, std::make_unique<mbgl::style::GeoJSONSource>(
jni::Make<std::string>(env, sourceId),
- convertGeoJSONOptions(env, options))
- ), converter(std::make_unique<Actor<FeatureConverter>>(*sharedThreadPool())) {
+ convertGeoJSONOptions(env, options)))
+ , threadPool(sharedThreadPool())
+ , converter(std::make_unique<Actor<FeatureConverter>>(*threadPool)) {
}
GeoJSONSource::GeoJSONSource(jni::JNIEnv& env,
mbgl::style::Source& coreSource,
AndroidRendererFrontend& frontend)
- : Source(env, coreSource, createJavaPeer(env), frontend)
- , converter(std::make_unique<Actor<FeatureConverter>>(*sharedThreadPool())) {
+ : Source(env, coreSource, createJavaPeer(env), frontend)
+ , threadPool(sharedThreadPool())
+ , converter(std::make_unique<Actor<FeatureConverter>>(*threadPool)) {
}
GeoJSONSource::~GeoJSONSource() = default;
diff --git a/platform/android/src/style/sources/geojson_source.hpp b/platform/android/src/style/sources/geojson_source.hpp
index b9c360c67c..24ea3c73f8 100644
--- a/platform/android/src/style/sources/geojson_source.hpp
+++ b/platform/android/src/style/sources/geojson_source.hpp
@@ -62,6 +62,7 @@ private:
jni::Object<Source> createJavaPeer(jni::JNIEnv&);
std::unique_ptr<Update> awaitingUpdate;
std::unique_ptr<Update> update;
+ std::shared_ptr<ThreadPool> threadPool;
std::unique_ptr<Actor<FeatureConverter>> converter;
template <class JNIType>