• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Garbage collector related crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Garbage collector related crash
      • From: Chris Idou <email@hidden>
References: 
 >Garbage collector related crash (From: Chris Idou <email@hidden>)

  • Prev by Date: Re: [Q] Correct way to identify an application, Launch Services, & Spaces
  • Next by Date: Re: [Q] Correct way to identify an application, Launch Services, & Spaces
  • Previous by thread: Garbage collector related crash
  • Next by thread: Re: Garbage collector related crash
  • Index(es):
    • Date
    • Thread