Skip to content

Commit 5101cb2

Browse files
authored
Fix retain cycle causing crash in RouteOverlayController on NavigationMapView reuse (#3222)
* Fix retain cycle causing crash in RouteOverlayController on NavigationMapView reuse * Update changelog
1 parent 40b1718 commit 5101cb2

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
* Added optional `NavigationEventsManager.userInfo` property that can be sent with all navigation events. The new optional property contains application metadata, such as the application name and version, that is included in each event to help Mapbox triage and diagnose unexpected behavior. ([#3007](https://github.com/mapbox/mapbox-navigation-ios/pull/3007)).
139139
* Fixed an issue when `GenericRouteShield` images would ignore changing it's foreground color in favor of cached image. ([#3217](https://github.com/mapbox/mapbox-navigation-ios/pull/3217))
140140
* Fixed an issue when route line was sometimes invisilbe after starting active guidance session. ([#3205](https://github.com/mapbox/mapbox-navigation-ios/pull/3205))
141+
* Fixed an issue where reusing `NavigationMapView` across multiple instances of `NavigationViewController` would result in a crash. ([#3222](https://github.com/mapbox/mapbox-navigation-ios/pull/3222))
141142

142143
## v1.4.1
143144

Sources/MapboxNavigation/RouteLineController.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,17 @@ extension NavigationMapView {
139139
// MARK: - NavigationComponentDelegate implementation
140140

141141
func navigationViewDidLoad(_ view: UIView) {
142-
navigationMapView.mapView.mapboxMap.onNext(.styleLoaded) { [self] _ in
143-
navigationMapView.localizeLabels()
144-
navigationMapView.mapView.showsTraffic = false
142+
navigationMapView.mapView.mapboxMap.onNext(.styleLoaded) { [weak self] _ in
143+
self?.navigationMapView.localizeLabels()
144+
self?.navigationMapView.mapView.showsTraffic = false
145145

146146
// FIXME: In case when building highlighting feature is enabled due to style changes and no info currently being stored
147147
// regarding building identification such highlighted building will disappear.
148148
}
149149

150150
// Route line should be added to `MapView`, when its style changes.
151-
navigationMapView.mapView.mapboxMap.onEvery(.styleLoaded) { [self] _ in
152-
showRouteIfNeeded()
151+
navigationMapView.mapView.mapboxMap.onEvery(.styleLoaded) { [weak self] _ in
152+
self?.showRouteIfNeeded()
153153
}
154154
}
155155

0 commit comments

Comments
 (0)