diff options
author | Jesse Crocker <jesse@gaiagps.com> | 2017-03-06 05:53:54 -0700 |
---|---|---|
committer | Jesse Crocker <jesse@gaiagps.com> | 2017-03-06 06:41:12 -0700 |
commit | 86ab2880ca35091ca9f25e9279792fb5569ffaf8 (patch) | |
tree | a009102cf42c67034704f254e0784dcdb476bc84 | |
parent | 0be7292227ca5008fe611dee89c799871776c37e (diff) | |
download | qtlocation-mapboxgl-86ab2880ca35091ca9f25e9279792fb5569ffaf8.tar.gz |
Update layer removal to be consistent with #7962
-rw-r--r-- | platform/darwin/src/MGLComputedShapeSource.mm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/platform/darwin/src/MGLComputedShapeSource.mm b/platform/darwin/src/MGLComputedShapeSource.mm index f65e898271..b4e4a6c54a 100644 --- a/platform/darwin/src/MGLComputedShapeSource.mm +++ b/platform/darwin/src/MGLComputedShapeSource.mm @@ -136,9 +136,20 @@ - (void)removeFromMapView:(MGLMapView *)mapView { [self.requestQueue cancelAllOperations]; + if (self.rawSource != mapView.mbglMap->getSource(self.identifier.UTF8String)) { + return; + } + auto removedSource = mapView.mbglMap->removeSource(self.identifier.UTF8String); - _pendingSource = std::move(reinterpret_cast<std::unique_ptr<mbgl::style::CustomVectorSource> &>(removedSource)); + mbgl::style::CustomVectorSource *source = dynamic_cast<mbgl::style::CustomVectorSource *>(removedSource.get()); + if (!source) { + return; + } + + removedSource.release(); + + _pendingSource = std::unique_ptr<mbgl::style::CustomVectorSource>(source); self.rawSource = _pendingSource.get(); } |