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
+4
View File
@@ -127,4 +127,8 @@ class CurrencyBarItem: CustomButtonTouchBarItem {
newTitle.setAlignment(.center, range: NSRange(location: 0, length: title.count))
attributedTitle = newTitle
}
deinit {
activity.invalidate()
}
}
+4
View File
@@ -135,4 +135,8 @@ class WeatherBarItem: CustomButtonTouchBarItem, CLLocationManagerDelegate {
// print("inside didChangeAuthorization ");
updateWeather()
}
deinit {
activity.invalidate()
}
}
+4
View File
@@ -121,6 +121,10 @@ class YandexWeatherBarItem: CustomButtonTouchBarItem, CLLocationManagerDelegate
func locationManager(_: CLLocationManager, didChangeAuthorization _: CLAuthorizationStatus) {
updateWeather()
}
deinit {
activity.invalidate()
}
}
extension String {