Skip to content

Commit

Permalink
[core] clear source when removed from style
Browse files Browse the repository at this point in the history
  • Loading branch information
ivovandongen committed Mar 7, 2017
1 parent 84f69bf commit 0da6d8a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mbgl/style/source_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ bool Source::Impl::isLoaded() const {

return true;
}

void Source::Impl::detach() {
invalidateTiles();
}

void Source::Impl::invalidateTiles() {
tiles.clear();
Expand Down
3 changes: 3 additions & 0 deletions src/mbgl/style/source_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ class Source::Impl : public TileObserver, private util::noncopyable {
// 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();
Expand Down
1 change: 1 addition & 0 deletions src/mbgl/style/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 0da6d8a

Please sign in to comment.