Skip to content

Commit

Permalink
Fix retain cycle causing crash in RouteOverlayController on Navigatio…
Browse files Browse the repository at this point in the history
…nMapView reuse (#3222)

* Fix retain cycle causing crash in RouteOverlayController on NavigationMapView reuse

* Update changelog
  • Loading branch information
irtemed88 committed Aug 4, 2021
1 parent 40b1718 commit 5101cb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
* 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)).
* 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))
* Fixed an issue when route line was sometimes invisilbe after starting active guidance session. ([#3205](https://github.com/mapbox/mapbox-navigation-ios/pull/3205))
* 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))

## v1.4.1

Expand Down
10 changes: 5 additions & 5 deletions Sources/MapboxNavigation/RouteLineController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@ extension NavigationMapView {
// MARK: - NavigationComponentDelegate implementation

func navigationViewDidLoad(_ view: UIView) {
navigationMapView.mapView.mapboxMap.onNext(.styleLoaded) { [self] _ in
navigationMapView.localizeLabels()
navigationMapView.mapView.showsTraffic = false
navigationMapView.mapView.mapboxMap.onNext(.styleLoaded) { [weak self] _ in
self?.navigationMapView.localizeLabels()
self?.navigationMapView.mapView.showsTraffic = false

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

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

Expand Down

0 comments on commit 5101cb2

Please sign in to comment.