fatal error: Index out of range
Fixed here: 36d559a
@danielgindi still crash...
@danielgindi seems not fix yet.
Step to reproduce:
class XAxisRenderer Line 217:
for i in stride(from: 0, to: entries.count, by: 1)
{
if centeringEnabled
{
position.x = CGFloat(xAxis.centeredEntries[i]) // crash
}
fatal error: Index out of range
values when crashing:
(lldb) po xAxis.centeredEntries
â–¿ 1 element
- 0 : 1474930800.0
(lldb) po axis?.entries
â–¿ Optional<Array<Double>>
â–¿ some : 6 elements
- 0 : 1474920000.0
- 1 : 1474925000.0
- 2 : 1474930000.0
- 3 : 1474935000.0
- 4 : 1474940000.0
- 5 : 1474945000.0
@Huang-Libo I got #1565 as attempt to fix, you could try first. Basically centeringEnabled is dirty read because after you zoom out again, axis.entries have more values while centeringEnabled might still be false and not refreshing xAxis.centeredEntries
@liuxuan30
zoom in until xAxis's label disappear and then zoom out, the demo crash(At the head of master branch):
0x1018426d0 <+112>: mov x4, x8
0x1018426d4 <+116>: bl 0x1017369b0 ; function signature specialization <preserving fragile attribute, Arg[1] = [Closure Propagated : reabstraction thunk helper from @callee_owned (@unowned Swift.UnsafeBufferPointer<Swift.UInt8>) -> () to @callee_owned (@unowned Swift.UnsafeBufferPointer<Swift.UInt8>) -> (@out ()), Argument Types : [@callee_owned (@unowned Swift.UnsafeBufferPointer<Swift.UInt8>) -> ()]> of generic specialization <preserving fragile attribute, ()> of Swift.StaticString.withUTF8Buffer <A> ((Swift.UnsafeBufferPointer<Swift.UInt8>) -> A) -> A
-> 0x1018426d8 <+120>: brk #0x1
2016-09-29 09:38:18.795411 ChartsDemo[1640:324855] [Accessibility] ****************** Loading GAX Client Bundle ****************
fatal error: Index out of range
2016-09-29 09:38:35.689019 ChartsDemo[1640:324855] fatal error: Index out of range
it does not get merged into master... yet. You have to manual change the code:
remove using local variable
centeringEnabled, because axis.entries would be changed butcenteringEnabledkeeps reading old entryCount, which seems a dirty read issue
@liuxuan30
Bug fixed.🎉