diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2018-09-04 09:36:57 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2018-09-04 11:18:55 -0700 |
commit | 260f96c2535672cba6ebe36d380c82f43fde492c (patch) | |
tree | 3761f38d9926c1654d23559cd6026101b1866c16 /platform | |
parent | 7227b4a7ec078d5eced98473c5a7181e5564b471 (diff) | |
download | qtlocation-mapboxgl-260f96c2535672cba6ebe36d380c82f43fde492c.tar.gz |
[android] Retain a shared thread pool reference
Otherwise it may be prematurely deleted.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/src/style/sources/geojson_source.cpp | 10 | ||||
-rw-r--r-- | platform/android/src/style/sources/geojson_source.hpp | 1 |
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> |