summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mbgl/style/source_impl.cpp4
-rw-r--r--src/mbgl/style/source_impl.hpp3
-rw-r--r--src/mbgl/style/style.cpp1
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;
}