Crash during animation on dismissed VC
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
* [ x] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](https://github.com/jjatie/Charts/blob/master/CONTRIBUTING.md).
## What did you do?
I am running a series of two delayed animations when a view controller appears.
` override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100)) { [ weak self] in
self?.graphView?.moveViewToAnimated(xValue: 20000, yValue: 0, axis: .left, duration: 0.5, easingOption: .easeOutQuad)
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(750)) {
self?.graphView?.moveViewToAnimated(xValue: 0, yValue: 0, axis: .left, duration: 0.5, easingOption: .easeInOutQuad)
}
}
}`
If the view controller is dismissed mid animation, the app crashes
## What did you expect to happen?
I would expect the app not to crash
## What happened instead?
The app crashed
`open class AnimatedMoveViewJob: AnimatedViewPortJob
{
internal override func animationUpdate()
{
var pt = CGPoint(
x: xOrigin + (CGFloat(xValue) - xOrigin) * phase,
y: yOrigin + (CGFloat(yValue) - yOrigin) * phase
)
transformer.pointValueToPixel(&pt)
viewPortHandler.centerViewPort(pt: pt, chart: view)
}
}`
it crashed on the line `transformer.pointValueToPixel(&pt)`
## Charts Environment
**Charts version/Branch/Commit Number:** 4.1.0
**Xcode version:**14.0.1
**Swift version:**5
**Platform(s) running Charts:**iOS
**macOS version running Xcode:**12.6
## Demo Project
Contributor guide
Assessment
This issue has not been assessed yet.