Thanks for the quick response. I am still a bit confused ... and, besides, I still get a core dump ;-(
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.
First of all, how can I know that? (I'm asking so that I can avoid such bugs in the future)
In the doc of CALayer.contents it says @property(retain) id contentsDoes a retained property always translate to a strong reference in a GC environment?
I tried thisCGImageRef cgImage = CFMakeCollectable ( CGImageSourceCreateImageAtIndex( sourceRef, 0, NULL ) );
// [snip] imgLayer.contents = (id) cgImage; // [snip] CGImageRelease( cgImage ); return imgLayer; and this:CGImageRef cgImage = CGImageSourceCreateImageAtIndex( sourceRef, 0, NULL );
// [snip] imgLayer.contents = (id) cgImage; // [snip] CFMakeCollectable( cgImage ); return imgLayer; Both yield the same crash at the same place. Did I misunderstand something? Or is the bug somewhere else?In the guide it says that CFMakeCollectable() does a CFRelease() -- is that the same as a CGImageRelease() ?
But cgImage isn't collectable, so the strong reference does nothing. Look at the documentaiton for CFMakeCollectable.
I did that and there is one sentence that I don't understand at all:"CFMakeCollectable calls CFRelease, but has two supplementary features: [...]; second, it’s a no-op in a reference counted environment."
Shouldn't that be "a no-op in a GC environment." ? Best regards, Gabriel.
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com