summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kitchen <andrew.kitchen@mapbox.com>2018-01-05 15:22:15 -0800
committerAndrew Kitchen <akitchen@gmail.com>2018-01-19 20:28:57 -0500
commitd0193c5b2b7140f54d6f166fa4e8a711a045915e (patch)
tree8f07e70edd959793785de3b572bf8a7f7851c655
parent2c48871c065c6efec42c5660c9560ecdfaa8d359 (diff)
downloadqtlocation-mapboxgl-d0193c5b2b7140f54d6f166fa4e8a711a045915e.tar.gz
Restores fix to MGLOpenGLStyleLayer memory-related crash (#10765)
Revert this commit to see integration test fail.
-rw-r--r--platform/darwin/src/MGLOpenGLStyleLayer.mm9
-rw-r--r--platform/darwin/src/MGLStyle.mm4
-rw-r--r--platform/darwin/src/MGLStyle_Private.h3
-rw-r--r--platform/ios/app/MBXViewController.m8
4 files changed, 3 insertions, 21 deletions
diff --git a/platform/darwin/src/MGLOpenGLStyleLayer.mm b/platform/darwin/src/MGLOpenGLStyleLayer.mm
index 2bc76c9912..8933a77382 100644
--- a/platform/darwin/src/MGLOpenGLStyleLayer.mm
+++ b/platform/darwin/src/MGLOpenGLStyleLayer.mm
@@ -47,8 +47,7 @@ void MGLDrawCustomStyleLayer(void *context, const mbgl::style::CustomLayerRender
when creating an OpenGL style layer.
*/
void MGLFinishCustomStyleLayer(void *context) {
- //TODO: AK: revert once failing test established
- MGLOpenGLStyleLayer *layer = (__bridge MGLOpenGLStyleLayer *)context;
+ MGLOpenGLStyleLayer *layer = (__bridge_transfer MGLOpenGLStyleLayer *)context;
[layer willMoveFromMapView:layer.style.mapView];
}
@@ -102,8 +101,7 @@ void MGLFinishCustomStyleLayer(void *context) {
MGLPrepareCustomStyleLayer,
MGLDrawCustomStyleLayer,
MGLFinishCustomStyleLayer,
- //TODO: AK: revert once failing test established
- (__bridge void *)self);
+ (__bridge_retained void *)self);
return self = [super initWithPendingLayer:std::move(layer)];
}
@@ -118,10 +116,7 @@ void MGLFinishCustomStyleLayer(void *context) {
[NSException raise:@"MGLLayerReuseException"
format:@"%@ cannot be added to more than one MGLStyle at a time.", self];
}
- //TODO: AK: remove once failing test established
- _style.openGLLayers[self.identifier] = nil;
_style = style;
- _style.openGLLayers[self.identifier] = self;
}
- (void)addToStyle:(MGLStyle *)style belowLayer:(MGLStyleLayer *)otherLayer {
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm
index 50d8abf72b..5221e838f8 100644
--- a/platform/darwin/src/MGLStyle.mm
+++ b/platform/darwin/src/MGLStyle.mm
@@ -77,8 +77,6 @@
@property (nonatomic, readonly, weak) MGLMapView *mapView;
@property (nonatomic, readonly) mbgl::style::Style *rawStyle;
@property (readonly, copy, nullable) NSURL *URL;
-//TODO: AK: remove once failing test established
-@property (nonatomic, readwrite, strong) NS_MUTABLE_DICTIONARY_OF(NSString *, MGLOpenGLStyleLayer *) *openGLLayers;
@property (nonatomic) NS_MUTABLE_DICTIONARY_OF(NSString *, NS_DICTIONARY_OF(NSObject *, MGLTextLanguage *) *) *localizedLayersByIdentifier;
@end
@@ -170,8 +168,6 @@ static NSURL *MGLStyleURL_trafficNight;
if (self = [super init]) {
_mapView = mapView;
_rawStyle = rawStyle;
- //TODO: AK: remove once failing test established
- _openGLLayers = [NSMutableDictionary dictionary];
_localizedLayersByIdentifier = [NSMutableDictionary dictionary];
}
return self;
diff --git a/platform/darwin/src/MGLStyle_Private.h b/platform/darwin/src/MGLStyle_Private.h
index 16035241f8..4cbe953a44 100644
--- a/platform/darwin/src/MGLStyle_Private.h
+++ b/platform/darwin/src/MGLStyle_Private.h
@@ -26,9 +26,6 @@ namespace mbgl {
- (nullable NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor;
-//TODO: AK: remove once failing test established
-@property (nonatomic, readonly, strong) NS_MUTABLE_DICTIONARY_OF(NSString *, MGLOpenGLStyleLayer *) *openGLLayers;
-
- (void)setStyleClasses:(NS_ARRAY_OF(NSString *) *)appliedClasses transitionDuration:(NSTimeInterval)transitionDuration;
@end
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 2fd2b69e83..4306354030 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -1683,11 +1683,8 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
numStyleURLMethods, (unsigned long)styleNames.count);
});
- MGLStyle *oldStyle = self.mapView.style;
- MGLStyleLayer *oldLayer = [oldStyle layerWithIdentifier:@"test-layer"];
- [oldStyle removeLayer:oldLayer];
-
self.styleIndex = (self.styleIndex + 1) % styleNames.count;
+
self.mapView.styleURL = styleURLs[self.styleIndex];
UIButton *titleButton = (UIButton *)self.navigationItem.titleView;
@@ -1934,9 +1931,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
// that a device with an English-language locale is already effectively
// using locale-based country labels.
_usingLocaleBasedCountryLabels = [[self bestLanguageForUser] isEqualToString:@"en"];
-
- MGLOpenGLStyleLayer *glLayer = [[MGLOpenGLStyleLayer alloc] initWithIdentifier:@"test-layer"];
- [style addLayer:glLayer];
}
- (void)mapViewRegionIsChanging:(MGLMapView *)mapView