1
0
mirror of https://github.com/Toxblh/MTMR.git synced 2026-01-10 17:08:39 +00:00

fix: need to properly stop periodic timer/activity on destroy to eliminate possible memory leaks

This commit is contained in:
bobrosoft 2019-08-06 16:37:57 +02:00
parent 63e3de7313
commit 2d64c091e3
3 changed files with 12 additions and 0 deletions

View File

@ -127,4 +127,8 @@ class CurrencyBarItem: CustomButtonTouchBarItem {
newTitle.setAlignment(.center, range: NSRange(location: 0, length: title.count)) newTitle.setAlignment(.center, range: NSRange(location: 0, length: title.count))
attributedTitle = newTitle attributedTitle = newTitle
} }
deinit {
activity.invalidate()
}
} }

View File

@ -135,4 +135,8 @@ class WeatherBarItem: CustomButtonTouchBarItem, CLLocationManagerDelegate {
// print("inside didChangeAuthorization "); // print("inside didChangeAuthorization ");
updateWeather() updateWeather()
} }
deinit {
activity.invalidate()
}
} }

View File

@ -121,6 +121,10 @@ class YandexWeatherBarItem: CustomButtonTouchBarItem, CLLocationManagerDelegate
func locationManager(_: CLLocationManager, didChangeAuthorization _: CLAuthorizationStatus) { func locationManager(_: CLLocationManager, didChangeAuthorization _: CLAuthorizationStatus) {
updateWeather() updateWeather()
} }
deinit {
activity.invalidate()
}
} }
extension String { extension String {