Restores fix to MGLOpenGLStyleLayer memory-related crash (#10765)
Revert this commit to see integration test fail.
This commit is contained in:
committed by
Andrew Kitchen
parent
2c48871c06
commit
d0193c5b2b
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user