summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLSymbolStyleLayer.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLSymbolStyleLayer.mm')
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.mm8
1 files changed, 4 insertions, 4 deletions
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm
index ae0ac2d6fa..0b065cd7b9 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.mm
+++ b/platform/darwin/src/MGLSymbolStyleLayer.mm
@@ -166,14 +166,14 @@ namespace mbgl {
- (void)removeFromMapView:(MGLMapView *)mapView
{
+ if (self.rawLayer != mapView.mbglMap->getLayer(self.identifier.UTF8String)) {
+ return;
+ }
+
auto removedLayer = mapView.mbglMap->removeLayer(self.identifier.UTF8String);
if (!removedLayer) {
return;
}
-
- auto originalLayer = std::make_unique<mbgl::style::SymbolLayer>(self.identifier.UTF8String, self.sourceIdentifier.UTF8String);
- _pendingLayer = std::move(originalLayer);
- self.rawLayer = _pendingLayer.get();
mbgl::style::SymbolLayer *layer = dynamic_cast<mbgl::style::SymbolLayer *>(removedLayer.get());
if (!layer) {