Skip to content

Commit

Permalink
FIX: memory leak in RouteMapViewController
Browse files Browse the repository at this point in the history
The old Timer API maintains a strong reference to `target`.
  • Loading branch information
michaelkirk committed Jun 27, 2024
1 parent 8fa646c commit 636ea92
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion MapboxNavigation/RouteMapViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,9 @@ private extension RouteMapViewController {

func resetETATimer() {
self.removeTimer()
self.updateETATimer = Timer.scheduledTimer(timeInterval: 30, target: self, selector: #selector(self.updateETA), userInfo: nil, repeats: true)
self.updateETATimer = Timer.scheduledTimer(withTimeInterval: 30, repeats: true) { [weak self] _ in
self?.updateETA()
}
}

func showRouteIfNeeded() {
Expand Down

0 comments on commit 636ea92

Please sign in to comment.