NSBezierPath buggy?
NSBezierPath buggy?
- Subject: NSBezierPath buggy?
- From: Mike Margolis <email@hidden>
- Date: Sun, 16 Sep 2001 21:58:53 -0700
I think i found a problem with NSBezierPath. I'm creating a few
simulation programs for my fractal geometry and chaos theory class, and
im using NSBezierPath's to graph out the results. At first this worked
great. Then I noticed the application would randomly segfault the more
I used NSBezierPath's (signal 11 SIGSEGV).
here is what i've been doing:
1) create the path in either ways, both of these seem to crash
NSBezierPath *thePath = [[NSBezierPath alloc] init];
or
NSBezierPath *thePath = [NSBezierPath bezierPath];
2) in a loop, add data points like so
for (...)
[thePath lineToPoint:NSMakePoint( datax[i] , datay[i] )];
3) stroke the path
[thePath stroke];
4) I tried not releasing/releasing/autoreleasing thePath, but the
crashes happen no matter what.
It works for a while, and randomly crashes. I ran the debugger to make
sure it wasn't in my code, and it found out the following:
Program received signal: "EXC_BAD_ACCESS"
and then there is the thread...
0 aa_lineto
1 RIPNoopContext
2 __initialize_Cplusplus
3 CGContextAddClip
4 CGContextClipToRect
and then some NSView stuff about locking the focus and doing the
heartBeat.
I've spent a while debugging my code and no matter what I do, using
these NSBezierPath's cause unpredictable crashes after I loop through
tons of times. I checked top and top -d, no memory leaks... it seems
like NSBezierPath's may have a subtle bug. Now, i'm not one to blame
the framework, the compiler, or the OS for my program not working, but
this seems to be happening no matter what i throw in.
I even tried throwing in totally reasonable values
for (i=0; i<1000; i++)
[thePath lineToPoint:NSMakePoint(100,i)];
and it still crashed.
If i remove the path creation code and not have it draw, the app runs
for hours and never crashes. I add the code, and it crashes in 5-10
seconds.
So, does this sound like a bug in NSBezierPath, or am I using it
improperly?
Thanks in advance,
Mike Margolis