diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-09-10 06:55:38 +0300 |
---|---|---|
committer | Julian Rex <julian.rex@mapbox.com> | 2019-09-09 23:55:38 -0400 |
commit | 5207a360746d7d0541e21ca4e8d22b432f41d8f5 (patch) | |
tree | 6bb894331c13de8c1f253872639f17ae3c3c6aea /include/mbgl/style/sources/vector_source.hpp | |
parent | 45140af7cb7f485008905a645e043480615109bc (diff) | |
download | qtlocation-mapboxgl-5207a360746d7d0541e21ca4e8d22b432f41d8f5.tar.gz |
[core, ios, macos] SDK objects should hold weak pointers to the core style objects (#15539)
Diffstat (limited to 'include/mbgl/style/sources/vector_source.hpp')
-rw-r--r-- | include/mbgl/style/sources/vector_source.hpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/mbgl/style/sources/vector_source.hpp b/include/mbgl/style/sources/vector_source.hpp index 6f16974b40..ece7f5615a 100644 --- a/include/mbgl/style/sources/vector_source.hpp +++ b/include/mbgl/style/sources/vector_source.hpp @@ -10,7 +10,7 @@ class AsyncRequest; namespace style { -class VectorSource : public Source { +class VectorSource final : public Source { public: VectorSource(std::string id, variant<std::string, Tileset> urlOrTileset); ~VectorSource() final; @@ -23,9 +23,14 @@ public: void loadDescription(FileSource&) final; + mapbox::base::WeakPtr<Source> makeWeakPtr() override { + return weakFactory.makeWeakPtr(); + } + private: const variant<std::string, Tileset> urlOrTileset; std::unique_ptr<AsyncRequest> req; + mapbox::base::WeakPtrFactory<Source> weakFactory {this}; }; template <> |