Re: Garbage collector related crash
Re: Garbage collector related crash
- Subject: Re: Garbage collector related crash
- From: Bill Bumgarner <email@hidden>
- Date: Fri, 08 May 2009 10:58:11 -0700
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