Reputation: 37
What's the difference between CFRelease and CFSafeRelease? Unfortunately I cannot find anything in the provided documentation.
Thanks!
Upvotes: 2
Views: 389
Reputation: 299325
There is no standard thing called CFSafeRelease
. You probably have a macro or function in your local code that defines something like:
#define CFSafeRelease(x) if (x) { CFRelease(x); x = NULL; }
Or something like that. This is a pretty common macro (though it's usually given a name like MYSafeRelease
or something else to keep it from looking like it's builtin).
Of course, occasionally you'll find it defined this way:
#define CFSafeRelease( cfobj ) if ( cfobj != NULL ) CFRelease( cfobj );
Which certainly is not a "safe release" since it leaves a dangling pointer....
Upvotes: 1