diff options
author | Chris Loer <chris.loer@gmail.com> | 2018-01-19 11:38:31 -0800 |
---|---|---|
committer | Chris Loer <chris.loer@mapbox.com> | 2018-01-19 14:50:42 -0800 |
commit | b2e71abfeeaf7326b47e54a0a255a3fe73628022 (patch) | |
tree | 6ba639c20443d7d8b757c3f79ad9e9b9313f7439 /src/mbgl/text/cross_tile_symbol_index.cpp | |
parent | 7c2e8c5eb1cda536be73e97afbc4b5276735fb51 (diff) | |
download | qtlocation-mapboxgl-b2e71abfeeaf7326b47e54a0a255a3fe73628022.tar.gz |
Prune unused layers from CrossTileSymbolIndex
Fixes issue #10939 -- removed layers would leak entries in the CrossTileSymbolIndex.
Diffstat (limited to 'src/mbgl/text/cross_tile_symbol_index.cpp')
-rw-r--r-- | src/mbgl/text/cross_tile_symbol_index.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mbgl/text/cross_tile_symbol_index.cpp b/src/mbgl/text/cross_tile_symbol_index.cpp index 8f4956c4ea..f88bab9d6f 100644 --- a/src/mbgl/text/cross_tile_symbol_index.cpp +++ b/src/mbgl/text/cross_tile_symbol_index.cpp @@ -169,6 +169,18 @@ bool CrossTileSymbolIndex::addLayer(RenderSymbolLayer& symbolLayer) { return symbolBucketsChanged; } +void CrossTileSymbolIndex::pruneUnusedLayers(const std::set<std::string>& usedLayers) { + std::vector<std::string> unusedLayers; + for (auto layerIndex : layerIndexes) { + if (usedLayers.find(layerIndex.first) == usedLayers.end()) { + unusedLayers.push_back(layerIndex.first); + } + } + for (auto unusedLayer : unusedLayers) { + layerIndexes.erase(unusedLayer); + } +} + void CrossTileSymbolIndex::reset() { layerIndexes.clear(); } |