summaryrefslogtreecommitdiff
path: root/src/mbgl/text/cross_tile_symbol_index.cpp
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2018-01-19 11:38:31 -0800
committerChris Loer <chris.loer@gmail.com>2018-01-19 11:38:31 -0800
commitf06eb0a6cfc1ff746959ce864aa5a35a5e080c92 (patch)
tree6ba639c20443d7d8b757c3f79ad9e9b9313f7439 /src/mbgl/text/cross_tile_symbol_index.cpp
parent7c2e8c5eb1cda536be73e97afbc4b5276735fb51 (diff)
downloadqtlocation-mapboxgl-f06eb0a6cfc1ff746959ce864aa5a35a5e080c92.tar.gz
Prune unused layers from CrossTileSymbolIndexupstream/cloer-10939
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.cpp12
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();
}