Sometimes my application is crashing on CFRelease(theURL);
CFURLRef theURL = CFURLCreateFromFSRef( kCFAllocatorDefault, inRef );
NSString *currentPath = [(NSURL *)theURL path];
CFRelease(theURL);
Thread 0 Crashed:
0 com.apple.CoreFoundation 0x92a53354 CFRelease + 36
Why?
The Create Rule
Core Foundation functions have names that indicate when you own a
returned object:Object-creation functions that have “Create” embedded in the name;
Object-duplication functions that have “Copy” embedded in the name. If
you own an object, it is your responsibility to relinquish ownership
(using CFRelease) when you have finished with it.
When
CFReleaseargument isNULL, the function will crash. Check the value returned fromCFURLCreateFromFSRef.