summaryrefslogtreecommitdiff
path: root/platform/macos/src/MGLMapView.mm
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@mapbox.com>2018-03-05 14:16:15 -0500
committerJulian Rex <julian.rex@mapbox.com>2018-03-05 14:16:15 -0500
commitbcdf23028e93a8216fc6b877486a04ac5a579c58 (patch)
tree19d34a5388695f0d7a559f539cf1fbb10bd74b3d /platform/macos/src/MGLMapView.mm
parent6fb2a94c5e1be320cc88bf9ed822fbd297223c4b (diff)
downloadqtlocation-mapboxgl-bcdf23028e93a8216fc6b877486a04ac5a579c58.tar.gz
[macos] Updated MGLMapView with new layer manager.upstream/jrex-custom-layer-style-changed-leak
Diffstat (limited to 'platform/macos/src/MGLMapView.mm')
-rw-r--r--platform/macos/src/MGLMapView.mm11
1 files changed, 8 insertions, 3 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index e54b0f195d..8b9a5a982f 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -15,6 +15,7 @@
#import "MGLMultiPoint_Private.h"
#import "MGLOfflineStorage_Private.h"
#import "MGLStyle_Private.h"
+#import "MGLStyleLayerRetentionManager_Private.h"
#import "MGLShape_Private.h"
#import "MGLAccountManager.h"
@@ -144,6 +145,7 @@ public:
@property (nonatomic, readwrite) NSView *attributionView;
@property (nonatomic, readwrite) MGLStyle *style;
+@property (nonatomic) MGLStyleLayerRetentionManager* styleLayerRetentionManager;
/// Mapping from reusable identifiers to annotation images.
@property (nonatomic) NS_MUTABLE_DICTIONARY_OF(NSString *, MGLAnnotationImage *) *annotationImagesByIdentifier;
@@ -256,6 +258,8 @@ public:
- (void)commonInit {
_isTargetingInterfaceBuilder = NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent;
+ _styleLayerRetentionManager = [[MGLStyleLayerRetentionManager alloc] init];
+
// Set up cross-platform controllers and resources.
_mbglView = new MGLMapViewImpl(self);
@@ -882,7 +886,7 @@ public:
return;
}
- [self.style retainLayersUsedDuringRendering];
+ [self.styleLayerRetentionManager updateRetainedLayers:self.style.managedLayers];
if ([self.delegate respondsToSelector:@selector(mapViewWillStartRenderingFrame:)]) {
[self.delegate mapViewWillStartRenderingFrame:self];
@@ -898,11 +902,12 @@ public:
_isChangingAnnotationLayers = NO;
[self.style didChangeValueForKey:@"layers"];
}
+
+ [self.styleLayerRetentionManager decrementLifetimes];
+
if ([self.delegate respondsToSelector:@selector(mapViewDidFinishRenderingFrame:fullyRendered:)]) {
[self.delegate mapViewDidFinishRenderingFrame:self fullyRendered:fullyRendered];
}
-
- [self.style releaseLayersUsedDuringRendering];
}
- (void)mapViewWillStartRenderingMap {