Skip to content

Commit

Permalink
Fix memory leak when showing shield icons. (#2880)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximAlien committed Mar 23, 2021
1 parent fd716e2 commit 35c7db3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/MapboxNavigation/RouteMapViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -911,10 +911,10 @@ extension RouteMapViewController: NavigationViewDelegate {
func roadShieldAttributedText(for text: String, textColor: UIColor, imageName: String) -> NSAttributedString? {
guard let image = navigationMapView.mapView.style.getStyleImage(with: imageName)?.cgImage() else { return nil }
let attachment = ShieldAttachment()
attachment.image = UIImage(cgImage: image.takeUnretainedValue()).withCenteredText(text,
color: textColor,
font: UIFont.boldSystemFont(ofSize: UIFont.systemFontSize),
scale: UIScreen.main.scale)
attachment.image = UIImage(cgImage: image.takeRetainedValue()).withCenteredText(text,
color: textColor,
font: UIFont.boldSystemFont(ofSize: UIFont.systemFontSize),
scale: UIScreen.main.scale)
return NSAttributedString(attachment: attachment)
}

Expand Down

0 comments on commit 35c7db3

Please sign in to comment.