From 02cccfe7e84a126770836d785e86fd78eace9694 Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Tue, 17 Mar 2015 17:46:33 -0700 Subject: properly clean up tile annotations on delete --- src/mbgl/map/annotation.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mbgl/map/annotation.cpp b/src/mbgl/map/annotation.cpp index b2a90f53c6..0d6da5781e 100644 --- a/src/mbgl/map/annotation.cpp +++ b/src/mbgl/map/annotation.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -109,6 +110,11 @@ std::vector AnnotationManager::removeAnnotations(std::vector if (annotation_it != annotations.end()) { auto& annotation = annotation_it->second; for (auto& tile_it : annotationTiles) { + auto& tileAnnotations = tile_it.second.first; + util::erase_if(tileAnnotations, tileAnnotations.begin(), + tileAnnotations.end(), [&](const uint32_t annotationID_) -> bool { + return (annotationID_ == annotationID); + }); auto features_it = annotation->tileFeatures.find(tile_it.first); if (features_it != annotation->tileFeatures.end()) { auto layer = tile_it.second.second->getMutableLayer(util::ANNOTATIONS_POINTS_LAYER_ID); -- cgit v1.2.1