summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLOpenGLStyleLayer.mm
diff options
context:
space:
mode:
authorAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-12-19 18:53:27 -0800
committerAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-12-19 18:58:38 -0800
commit2b2164f6cedced4c5e273aef3e936c0270e8e595 (patch)
tree0c84da21bc746a3c1ddce3ff843ccc5593411871 /platform/darwin/src/MGLOpenGLStyleLayer.mm
parentea6ff4eb332cd3fd0969f69684a8bb6e7b1507d4 (diff)
downloadqtlocation-mapboxgl-2b2164f6cedced4c5e273aef3e936c0270e8e595.tar.gz
[iOS, macOS] Use toll-free bridging to retain/release MGLOpenGLStyleLayer instead of a separate array.upstream/custom-layer-fix
Diffstat (limited to 'platform/darwin/src/MGLOpenGLStyleLayer.mm')
-rw-r--r--platform/darwin/src/MGLOpenGLStyleLayer.mm6
1 files changed, 2 insertions, 4 deletions
diff --git a/platform/darwin/src/MGLOpenGLStyleLayer.mm b/platform/darwin/src/MGLOpenGLStyleLayer.mm
index 36a3c20c97..8933a77382 100644
--- a/platform/darwin/src/MGLOpenGLStyleLayer.mm
+++ b/platform/darwin/src/MGLOpenGLStyleLayer.mm
@@ -47,7 +47,7 @@ void MGLDrawCustomStyleLayer(void *context, const mbgl::style::CustomLayerRender
when creating an OpenGL style layer.
*/
void MGLFinishCustomStyleLayer(void *context) {
- MGLOpenGLStyleLayer *layer = (__bridge MGLOpenGLStyleLayer *)context;
+ MGLOpenGLStyleLayer *layer = (__bridge_transfer MGLOpenGLStyleLayer *)context;
[layer willMoveFromMapView:layer.style.mapView];
}
@@ -101,7 +101,7 @@ void MGLFinishCustomStyleLayer(void *context) {
MGLPrepareCustomStyleLayer,
MGLDrawCustomStyleLayer,
MGLFinishCustomStyleLayer,
- (__bridge void *)self);
+ (__bridge_retained void *)self);
return self = [super initWithPendingLayer:std::move(layer)];
}
@@ -116,9 +116,7 @@ void MGLFinishCustomStyleLayer(void *context) {
[NSException raise:@"MGLLayerReuseException"
format:@"%@ cannot be added to more than one MGLStyle at a time.", self];
}
- _style.openGLLayers[self.identifier] = nil;
_style = style;
- _style.openGLLayers[self.identifier] = self;
}
- (void)addToStyle:(MGLStyle *)style belowLayer:(MGLStyleLayer *)otherLayer {