diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-03-06 17:19:38 -0800 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-03-06 18:04:22 -0800 |
commit | 0da6d8a646746831819525fd37cff3ed0af9589b (patch) | |
tree | 6b2699f7dd1c1871d36be26e253f44e85e97851b | |
parent | 84f69bfcc0e276a2dc3fd515a2425069dd47f442 (diff) | |
download | qtlocation-mapboxgl-0da6d8a646746831819525fd37cff3ed0af9589b.tar.gz |
[core] clear source when removed from style
-rw-r--r-- | src/mbgl/style/source_impl.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/style/source_impl.hpp | 3 | ||||
-rw-r--r-- | src/mbgl/style/style.cpp | 1 |
3 files changed, 8 insertions, 0 deletions
diff --git a/src/mbgl/style/source_impl.cpp b/src/mbgl/style/source_impl.cpp index 22e51f8885..fdacb00b4c 100644 --- a/src/mbgl/style/source_impl.cpp +++ b/src/mbgl/style/source_impl.cpp @@ -44,6 +44,10 @@ bool Source::Impl::isLoaded() const { return true; } + +void Source::Impl::detach() { + invalidateTiles(); +} void Source::Impl::invalidateTiles() { tiles.clear(); diff --git a/src/mbgl/style/source_impl.hpp b/src/mbgl/style/source_impl.hpp index ea2135c3c1..54af93c04f 100644 --- a/src/mbgl/style/source_impl.hpp +++ b/src/mbgl/style/source_impl.hpp @@ -87,6 +87,9 @@ public: // be initialized to true so that Style::isLoaded() does not produce false positives if // called before Style::recalculate(). bool enabled = true; + + // Detaches from the style + void detach(); protected: void invalidateTiles(); diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp index aacf811f4d..5b45ca27ef 100644 --- a/src/mbgl/style/style.cpp +++ b/src/mbgl/style/style.cpp @@ -166,6 +166,7 @@ std::unique_ptr<Source> Style::removeSource(const std::string& id) { sources.erase(it); updateBatch.sourceIDs.erase(id); + source->baseImpl->detach(); return source; } |