Assume some plug-in, which must work with garbage collection on or off.
Assume further, that there is a method (not under our control):

- (NSString *)copySomething;

And that this method returns either an NSString* or a toll free bridged CFStringRef, of which we are the owner (because the name contains "copy").

If we do:
NSString *s = [ someObject copySomething];
// do something with "s"
[s release];

it will work without garbage collection, but leak otherwise in the case of a CFStringRef.
How to get rid of "s" ?
Simply calling CFRelease() is no good, because it might be an NSString* on which someone has done a CFRetain().


Kind regards,

Gerriet.

_______________________________________________

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

Reply via email to