From 98e89208357e3ae586791e9d3844c52eac5f133b Mon Sep 17 00:00:00 2001 From: Alexander Shalamov Date: Thu, 2 May 2019 11:37:02 +0200 Subject: [core] Keep shared_ptr to thread pool in CustomGeometrySource CustomGeometrySource should keep strong reference to shared thread pool that is used by CustomTileLoader. --- include/mbgl/style/sources/custom_geometry_source.hpp | 2 ++ src/mbgl/style/sources/custom_geometry_source.cpp | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/mbgl/style/sources/custom_geometry_source.hpp b/include/mbgl/style/sources/custom_geometry_source.hpp index 9daeeb3819..3f29d0c0fb 100644 --- a/include/mbgl/style/sources/custom_geometry_source.hpp +++ b/include/mbgl/style/sources/custom_geometry_source.hpp @@ -12,6 +12,7 @@ class OverscaledTileID; class CanonicalTileID; template class Actor; +class ThreadPool; namespace style { @@ -46,6 +47,7 @@ public: class Impl; const Impl& impl() const; private: + std::shared_ptr threadPool; std::unique_ptr> loader; }; diff --git a/src/mbgl/style/sources/custom_geometry_source.cpp b/src/mbgl/style/sources/custom_geometry_source.cpp index 6ce7c1be11..7420be9320 100644 --- a/src/mbgl/style/sources/custom_geometry_source.cpp +++ b/src/mbgl/style/sources/custom_geometry_source.cpp @@ -14,7 +14,8 @@ namespace style { CustomGeometrySource::CustomGeometrySource(std::string id, const CustomGeometrySource::Options options) : Source(makeMutable(std::move(id), options)), - loader(std::make_unique>(*sharedThreadPool(), options.fetchTileFunction, options.cancelTileFunction)) { + threadPool(sharedThreadPool()), + loader(std::make_unique>(*threadPool, options.fetchTileFunction, options.cancelTileFunction)) { } CustomGeometrySource::~CustomGeometrySource() = default; -- cgit v1.2.1