Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Retain a shared thread pool reference
Browse files Browse the repository at this point in the history
Otherwise it may be prematurely deleted.
  • Loading branch information
jfirebaugh committed Sep 5, 2018
1 parent ce6c382 commit a541048
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions platform/android/src/style/sources/geojson_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions platform/android/src/style/sources/geojson_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class GeoJSONSource : public Source {
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>
Expand Down

0 comments on commit a541048

Please sign in to comment.