[core] Keep shared_ptr to thread pool in CustomGeometrySource

CustomGeometrySource should keep strong reference to shared thread
pool that is used by CustomTileLoader.
This commit is contained in:
Alexander Shalamov
2019-05-02 11:37:02 +02:00
parent f7915fdc51
commit 86b94e30e1
2 changed files with 4 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ class OverscaledTileID;
class CanonicalTileID;
template <class T>
class Actor;
class ThreadPool;
namespace style {
@@ -46,6 +47,7 @@ public:
class Impl;
const Impl& impl() const;
private:
std::shared_ptr<ThreadPool> threadPool;
std::unique_ptr<Actor<CustomTileLoader>> loader;
};

View File

@@ -14,7 +14,8 @@ namespace style {
CustomGeometrySource::CustomGeometrySource(std::string id,
const CustomGeometrySource::Options options)
: Source(makeMutable<CustomGeometrySource::Impl>(std::move(id), options)),
loader(std::make_unique<Actor<CustomTileLoader>>(*sharedThreadPool(), options.fetchTileFunction, options.cancelTileFunction)) {
threadPool(sharedThreadPool()),
loader(std::make_unique<Actor<CustomTileLoader>>(*threadPool, options.fetchTileFunction, options.cancelTileFunction)) {
}
CustomGeometrySource::~CustomGeometrySource() = default;