Charts icon indicating copy to clipboard operation
Charts copied to clipboard

Crash during animation on dismissed VC

Open julien-tamade opened this issue 2 years ago • 4 comments

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 linetransformer.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

julien-tamade avatar Dec 22 '22 06:12 julien-tamade

Same problem,did you solve it? May you can back to v3.6.0

fengli12321 avatar Jan 05 '23 03:01 fengli12321

Same problem,did you solve it? May you can back to v3.6.0 When VC pop or dismiss, 'transformer' and 'viewPortHandler' will be released, so it crashed. In old version (v3.6.0), this property is modifiered by 'weak', so It run good

fengli12321 avatar Jan 05 '23 03:01 fengli12321

Same problem

ChanRoy avatar Jul 19 '23 02:07 ChanRoy

Same problem

Toj-dev avatar Jun 07 '24 08:06 Toj-dev