A few years ago, I switched my code to ARC. Now, I have this in my code:
CGImageRef imageRef = CGImageSourceCreateImageAtIndex( sourceRef, 0, NULL );
...
NSImage * nsimage = [self convertToNSImage: img withOrientation:
img_orientation];
assign nsimage to a layer
...
CGImageRelease( imageRef );
...
use the layer with the nsimage
The doc for CGImageSourceCreateImageAtIndex() that I need to release imageRef
myself.
Is it safe to do it after assigning the nsimage to the layer, but before
deleting the layer?
Or should I keep the imageRef until the layer itself gets removed from its
super layer?
Also, I have some more release's in my code, and I would appreciate your advice
whether or not I still need them. (Sometimes, I still get confused.)
io_service_t serv = [self IOServicePortFromCGDisplayID: displayID];
CFDictionaryRef info = IODisplayCreateInfoDictionary(serv,
kIODisplayOnlyPreferredName);
IOObjectRelease(serv);
Is the IOObjectRelease() right or wrong ?
Thanks a lot in advance.
Best regards, Gabriel
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
