I have a piece of code that draws a curve and has been in the app for at least a year without any problems. Over the last three days I am suddenly getting about 10 crash reports per day, all from iOS 7 users. The reports says that the line "for(int i=1 etc" crashes, but I can't begin to understand the problem with that. The crash log refers to CoreGraphics so it is probably the line before that causes the problem. Here is the code:
CGContextBeginPath(cctx);
int step=220/lookupCount;
acx = 0;
acy = hf*100-bestResults[0]*hf*100/top;
CGContextMoveToPoint(cctx, acx, acy);
for(int i=1;i<lookupCount;i++){ //line 2005
acx = hf*i*step;
acy = hf*100-bestResults[i]*hf*100/top;
CGContextAddLineToPoint(cctx, acx , acy);
}
CGContextStrokePath(cctx);
And a piece of the crash log:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x395311fc ___pthread_kill + 8
1 libsystem_c.dylib 0x394e202d _abort + 77
2 libsystem_c.dylib 0x394c1c6b ___assert_rtn + 183
3 CoreGraphics 0x2ed0da09 CG::Path::is_empty() const + 1
4 racquetTune 0x000942d5 -[tension autoCorr] (tension.m:2005)
I have been trying to recreate the crash by setting the different variables to zero or make them infinite, but with any "success". Is anyone aware of changes in CoreGraphics in iOS7 that could cause this?
The crashes comes different types of hardware and represent a small number of the users, but are still too frequent to ignore. An interesting detail is that there were no crash reports from the two first days when iOS 7 was available but a steady stream after that.