Re: EXC_BAD_ACCESS when -fobjc-gc is on (Was: Memory corruption ...)
Re: EXC_BAD_ACCESS when -fobjc-gc is on (Was: Memory corruption ...)
- Subject: Re: EXC_BAD_ACCESS when -fobjc-gc is on (Was: Memory corruption ...)
- From: "Stephen J. Butler" <email@hidden>
- Date: Wed, 7 Oct 2009 13:30:12 -0500
On Wed, Oct 7, 2009 at 1:13 PM, Gabriel Zachmann <email@hidden> wrote:
> - (CALayer *) makeImageLayer: (NSString *) img_name inRect: (NSSize) size
> {
> // [snip]
> CGImageRef cgImage = CGImageSourceCreateImageAtIndex( sourceRef, 0, NULL
> );
> // [snip]
> imgLayer.contents = (id) cgImage;
> // [snip]
> CGImageRelease( cgImage );
>
> return imgLayer;
> }
I think this is your problem right here. In a GC environment CALayer
isn't going to retain its content, it stores a strong reference
instead. But cgImage isn't collectable, so the strong reference does
nothing. Look at the documentaiton for CFMakeCollectable.
_______________________________________________
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