Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core] clear source when removed from style #8298

Merged
merged 1 commit into from
Mar 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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