summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@mapbox.com>2018-11-16 15:09:51 -0500
committerJulian Rex <julian.rex@mapbox.com>2018-11-19 18:22:25 -0500
commit4696a8dda03dc332c72bd7bd4cdafab12308bba9 (patch)
tree27553bde5d2a7446a0f368caedf3bc6812bf7220
parenta8970cc7efa35b4679e34ee95f60ce6ea3e8e4ae (diff)
downloadqtlocation-mapboxgl-4696a8dda03dc332c72bd7bd4cdafab12308bba9.tar.gz
Only set `_pendingSource` & clear `_mapView` if the source was removed.
-rw-r--r--platform/darwin/src/MGLSource.mm8
1 files changed, 5 insertions, 3 deletions
diff --git a/platform/darwin/src/MGLSource.mm b/platform/darwin/src/MGLSource.mm
index 3ec82ff36e..3403868d84 100644
--- a/platform/darwin/src/MGLSource.mm
+++ b/platform/darwin/src/MGLSource.mm
@@ -62,11 +62,13 @@
BOOL removed = NO;
if (self.rawSource == mapView.style.rawStyle->getSource(self.identifier.UTF8String)) {
- _pendingSource = mapView.style.rawStyle->removeSource(self.identifier.UTF8String);
- _mapView = nil;
- if (_pendingSource) {
+ auto removedSource = mapView.style.rawStyle->removeSource(self.identifier.UTF8String);
+
+ if (removedSource) {
removed = YES;
+ _pendingSource = std::move(removedSource);
+ _mapView = nil;
} else if (outError) {
NSString *format = NSLocalizedStringWithDefaultValue(@"REMOVE_SRC_FAIL_IN_USE_FMT", nil, nil, @"Source '%@' is in use, cannot remove.", @"User-friendly error description");
NSString *localizedDescription = [NSString stringWithFormat:format, self.identifier];