Should i release return object from CGImageSourceCopyPropertiesAtIndex call?
It's not stated in documentation for CGImageSource开发者_开发知识库CopyPropertiesAtIndex
function. But am i right that i should call CFRelease
on retured CFDictionaryRef
?
Quick sample:
NSDictionary* metadata = (NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source,0,NULL);
......................
//Should i call CFRelease(metadata); ??
Thanks.
Yes you should release it.
It doesn't say it in the documentation because it's a general convention. Every object returned by a function with Copy
or Create
in its name is owned by you and should be released when you're done.
For GC, you can do this too:
(NSDictionary *)NSMakeCollectable( CGImageSourceCopyPropertiesAtIndex(sourceRef, 0, (CFDictionaryRef)options) );
精彩评论