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

Fix crash getting annotation view #6957

Merged

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Nov 8, 2016

Streamlined -[MGLMapView annotationTagForAnnotation:] to use the std::map added in #5987 on iOS. Added the same map to the macOS implementation.

Replaced unsafe calls to std::map::at() – which throws an exception when the given element isn’t found – with calls to the newly streamlined -annotationTagForAnnotation:. One of these unsafe calls was added in #5987 and is reverted by this PR in favor of returning nil.

Return the user location annotation view when given the user location annotation.

Fixes #6953.

/cc @boundsj

1ec5 added 2 commits November 7, 2016 23:00
Optimized lookup of annotation tags by annotation from O(n) to a simple map lookup, for better performance and consistency with the iOS implementation of MGLMapView.
Streamlined -[MGLMapView annotationTagForAnnotation:] to use the mapping added in #5987. Reverted an unsafe access into that mapping that was added in #5987; returning nil is preferable when no such annotation can be found. Return the user location annotation view when given the user location annotation.
@1ec5 1ec5 added iOS Mapbox Maps SDK for iOS performance Speed, stability, CPU usage, memory usage, or power usage macOS Mapbox Maps SDK for macOS crash annotations Annotations on iOS and macOS or markers on Android labels Nov 8, 2016
@1ec5 1ec5 added this to the ios-v3.4.0 milestone Nov 8, 2016
@1ec5 1ec5 self-assigned this Nov 8, 2016
@mention-bot
Copy link

@1ec5, thanks for your PR! By analyzing the history of the files in this pull request, we identified @boundsj, @incanus and @rmnblm to be potential reviewers.

@1ec5 1ec5 merged commit f2ba2b2 into release-ios-v3.4.0 Nov 9, 2016
@1ec5 1ec5 deleted the 1ec5-annotation-view-map-consolidation-6953 branch November 9, 2016 06:51
@1ec5 1ec5 mentioned this pull request Mar 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
annotations Annotations on iOS and macOS or markers on Android crash iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS performance Speed, stability, CPU usage, memory usage, or power usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants