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 protected]> To: Chris Idou <[email protected]> Cc: [email protected] 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 protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
