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/layer.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/layer.hpp')
-rw-r--r-- | include/mbgl/style/layer.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/mbgl/style/layer.hpp b/include/mbgl/style/layer.hpp index a66ff37b22..cfaca60e60 100644 --- a/include/mbgl/style/layer.hpp +++ b/include/mbgl/style/layer.hpp @@ -6,6 +6,8 @@ #include <mbgl/style/types.hpp> #include <mbgl/style/conversion.hpp> +#include <mapbox/weak.hpp> + #include <cassert> #include <memory> #include <string> @@ -124,10 +126,15 @@ public: const LayerTypeInfo* getTypeInfo() const noexcept; + mapbox::base::WeakPtr<Layer> makeWeakPtr() { + return weakFactory.makeWeakPtr(); + } + protected: virtual Mutable<Impl> mutableBaseImpl() const = 0; LayerObserver* observer; + mapbox::base::WeakPtrFactory<Layer> weakFactory {this}; }; } // namespace style |