Re: [NSBezierPath bezierpath]
Re: [NSBezierPath bezierpath]
- Subject: Re: [NSBezierPath bezierpath]
- From: Greg Miller <email@hidden>
- Date: Thu, 29 Jan 2004 16:50:57 -0500
I assume [NSBezierPath bezierpath] issues an autorelease before it
returns the object. Which means that when you autorelease it (again)
you've just decremented the reference count one to many times. When
you use the alloc/init methods for creating your Bezier Path object
there is no autorelease issued, and the one that you explicitly issue
is the only one -- thus your reference count is correct.
G~
On Jan 25, 2004, at 5:40 PM, Pierre DOUCY wrote:
I'am using the NSBezierPath class quite extensively these days, and
something weird happened:
if I do something like :
bp = [NSBezierPath bezierpath];
( insert lineToPoint, curveToPoint here)
in a NSView subclass' -initWithFrame (bp being an instance variable in
my NSView) and
[bp fill]
in the drawInRect of the same view, everything works fine.
However, when I decide that I should initialize my NSBezierPaths
elsewhere, my app dies with a SIGBUS. That's what I don't understand
because I issued a [bezierpath autorelease] before returning each new
instance.
After a bunch of debugging, I see that the initWithFrame works well
(bp is here and I can use it), but any [bp fill] issued within the
drawInRect leads to the SIGBUS.
Now, when I replace the [NSBezierPath bezierPath] with a
[[NSBezierPath alloc] init] in my new function, everything is ok.
What do I miss here ? What does this [NSBezierPath bezierPath]
selector actually do ? I can't see any info in the cocoa docs.
Greg Miller
America Online, Inc.
Sr. Systems Administrator
(p) 614.538.3218
(e) email@hidden
"If it isn't broken, take it apart and find out why."
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.