-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash originating in ChartViewPortHandler #576
Comments
public func isInBoundsRight(x: CGFloat) -> Bool
{
let normalizedX = CGFloat(Int(x * 100.0)) / 100.0
return (_contentRect.origin.x + _contentRect.size.width) >= normalizedX ? true : false
} The crashes happened in drawCircles from the trace: for (var j = minx, count = Int(ceil(CGFloat(maxx - minx) * phaseX + CGFloat(minx))); j < count; j++)
{
let e = entries[j]
pt.x = CGFloat(e.xIndex)
pt.y = CGFloat(e.value) * phaseY
pt = CGPointApplyAffineTransform(pt, valueToPixelMatrix)
if (!viewPortHandler.isInBoundsRight(pt.x))
{
break
} I guess e.xIndex is transformed to nan and cause crash? Have you changed anything around the x, xIndex, transformer matrix? These kinds of crashes is a little hard to tell. If you are not sure, maybe add a CLS_LOG to capture what is the x value before and after transform. Also try to capture as many values as possible to help understand what happened, if allowed. |
No, I'm not doing anything with regards to ios-charts, other than having one on a Storyboard, connected to a ViewController and setting some styles and data. What I find really strange, however, is that the stack trace boils down to the AppDelegate with no mention of a ViewController whatsoever. Capturing extra data is not possible atm, since I cannot reproduce and the crash is happening somewhere 'in the field'. What I did fail to mention, was the Exception type and code:
|
Because it crashes inside drawRect of a run loop, at that time, the view controller stuff is not captured. Only things in drawRect and its context. if you are using crashlytics, is your/your company policy allowed to log down values before/after the transform by using CLSLogv? CLSLogv("pt.x %f, xValCount:%d before transform", getVaList([pt.x, _data.xValCount]))
...
CLSLogv("pt.x %f, xValCount:%d after transform", getVaList([pt.x, _data.xValCount])) Usually for this kind of crashes we need to know the x values and data entries to knock it down, it's data related. |
Thanks, I'll add the provided code. I'll get back to you, when I have more information. |
I'm getting an exception in the same place. here is my data:
I'm getting it in |
@tsznober since you get it, you see |
@fguchelaar remember to add enough variables to log down. Like the matrix values when crashing, values can help calculate the matrix, _viewPortHandler.contentRect, etc. |
@liuxuan30 I captured a bit more data. I did a po for getTransformer(.Left) at the point of the crash. Does this help?
|
Of course, you see |
Actually, @fguchelaar and @liuxuan30 , So my only guess is a compiler bug... @fguchelaar seems like your scaling is so off, nearing Infinity - so that creates NaN values. I guess you already know what's wrong with your data since you haven't responded for 14 days. |
@danielgindi well... I actually don't know what's wrong. The issue just did not reoccur again (which, off course, is a good thing). |
I suspect that it could be tied to empty |
Great! If anything new comes up, I'll report back. |
After running a couple of weeks with no issues, today I received a crashreport through Crashlytics for my app. It's the first time I'm seeing this crash and (sadly?) I am not able to reproduce it. Any thoughts?
Details:
Charts version 2.1.4, installed with CocoaPods
Crash reported from an iPad 4, running iOS 9.1
The text was updated successfully, but these errors were encountered: