Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Recreate pending and raw layer ref when layer is removed - #8055

Closed
boundsj wants to merge 1 commit into
masterfrom
boundsj-safer-remove-from-mapview
Closed

boundsj wants to merge 1 commit into
masterfrom
boundsj-safer-remove-from-mapview

Conversation

@boundsj

@boundsj boundsj commented Feb 14, 2017

Copy link
Copy Markdown
Contributor

Fixes #8053

cc @1ec5

@boundsj boundsj added crash iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling labels Feb 14, 2017
@boundsj boundsj added this to the ios-v3.5.0 milestone Feb 14, 2017
@boundsj boundsj self-assigned this Feb 14, 2017
@boundsj
boundsj requested a review from 1ec5 February 14, 2017 21:11
@mention-bot

Copy link
Copy Markdown

@boundsj, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh and @1ec5 to be potential reviewers.

@boundsj

boundsj commented Feb 14, 2017

Copy link
Copy Markdown
Contributor Author

When #7962 lands, this PR could be updated to add tests for the scenario described in #7962 (comment)

}
auto originalLayer = std::make_unique<mbgl::style::BackgroundLayer>(self.identifier.UTF8String);
_pendingLayer = std::move(originalLayer);
self.rawLayer = _pendingLayer.get();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, these new lines are only relevant to the case where we bail below due to removing a layer of a different type than this class, correct? Otherwise, we’ll end up making the removed layer the pending layer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct @1ec5. It is only to protect against that edge. I guess that could happen if you add a layer of type foo with identity bar and then (before adding) try to remove a layer of type baz with identity bar.

@boundsj
boundsj force-pushed the boundsj-safer-remove-from-mapview branch from 4fa67b6 to 500f683 Compare February 15, 2017 20:01
@boundsj

boundsj commented Feb 23, 2017

Copy link
Copy Markdown
Contributor Author

This is now happening in #7962

@boundsj boundsj closed this Feb 23, 2017
@boundsj
boundsj deleted the boundsj-safer-remove-from-mapview branch March 2, 2017 18:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

crash iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants