Re: Garbage collector related crash
Re: Garbage collector related crash
- Subject: Re: Garbage collector related crash
- From: Chris Idou <email@hidden>
- Date: Sun, 10 May 2009 03:47:37 -0700 (PDT)
When you are saying "it is broken" on Leopard, what exactly do you say you know is broken? GC in general, or the __strong thing, or.... ?
________________________________
From: Bill Bumgarner <email@hidden>
To: Chris Idou <email@hidden>
Cc: email@hidden
Sent: Saturday, 9 May, 2009 3:58:11 AM
Subject: Re: Garbage collector related crash
On May 8, 2009, at 12:47 AM, Chris Idou wrote:
> I've got an object that holds onto a CF ref:
>
> mdref= MDItemCreate(nil, (CFStringRef)path);
> [NSMakeCollectable(mdref) autorelease];
>
> I think I'm doing the right thing in the class declaration:
>
>
> @interface MetadataItem : NSObject {
> __strongMDItemRefmdref;
> @end
>
> But every now and then:
>
> CFTypeRefres = MDItemCopyAttribute(mdref, (CFStringRef)key);
>
> this makes it crash horribly. It's got to have something to do with garbage collection, but it seems like I'm doing things right. Any thoughts?
It is broken on Leopard (and fixed in a future release); please file a bug and send me the bug #. Attach your binary to the bug with steps to reproduce.
One workaround for now -- not a very good workaround, but a workaround -- is to CFRetain the mdref as soon as you create it. Then never ever CFRelease it. Yes, it'll leak (fortunately these are small). But it won't crash (unless some other subsystem does code like yours above out of your control).
b.bum
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden