You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Removing a style layer before adding the same layer should not cause a crash #8053
On iOS/macOS, -[MGL*StyleLayer removeFromMapView:] clears its internal state before telling mbgl to remove the layer from the style. If the layer isn’t part of the style, -removeFromMapView: will bail, resulting in an unusable MGLStyleLayer object. The following code would crash:
MGLBackgroundStyleLayer *fillLayer = [[MGLBackgroundStyleLayer alloc] initWithIdentifier:@"bg"];
[style removeLayer:fillLayer]; // no-op
// …
[style addLayer:fillLayer]; // MGLRedundantLayerException
I think the correct behavior would be to ensure that _pendingLayer ends up with whatever either _pendingLayer or rawLayer had at the beginning of this method.
I think we can address this by moving the pointer / property assign statements in between the early returns of the methods and setting them to values that they would have had when the Objective-C layer object was created in the first place (#7962 (comment))
Activity
boundsj commentedon Feb 23, 2017
This was fixed in #7962.