From Ed Ralston, "According to the OSX Developer Documentation, CFRelease

cannot be called with a NULL argument.

This patch prevents osgDB::FileUtils from doing this."
This commit is contained in:
Robert Osfield 2006-02-20 16:20:50 +00:00
parent 9935b0fa27
commit 1c83e3ecfb

View File

@ -497,8 +497,10 @@ std::string osgDB::findFileInDirectory(const std::string& fileName,const std::st
std::string path;
CFURLRef urlRef = CFBundleCopyBundleURL(mainBundle);
if(urlRef)
{
path = GetPathFromCFURLRef(urlRef);
CFRelease(urlRef); // docs say we are responsible for releasing CFURLRef
CFRelease(urlRef); // docs say we are responsible for releasing CFURLRef
}
return path;
}
@ -513,8 +515,10 @@ std::string osgDB::findFileInDirectory(const std::string& fileName,const std::st
std::string path;
CFURLRef urlRef = CFBundleCopyBuiltInPlugInsURL(mainBundle);
if(urlRef)
{
path = GetPathFromCFURLRef(urlRef);
CFRelease(urlRef);
CFRelease(urlRef);
}
return path;
}
@ -524,8 +528,10 @@ std::string osgDB::findFileInDirectory(const std::string& fileName,const std::st
std::string path;
CFURLRef urlRef = CFBundleCopyResourcesDirectoryURL(mainBundle);
if(urlRef)
{
path = GetPathFromCFURLRef(urlRef);
CFRelease(urlRef);
CFRelease(urlRef);
}
return path;
}
@ -682,11 +688,13 @@ std::string osgDB::findFileInDirectory(const std::string& fileName,const std::st
// Get the URL
url = CFURLCreateFromFSRef( 0, &f );
if(url)
{
filepath.push_back(GetPathFromCFURLRef(url) + OSG_PLUGIN_PATH);
CFRelease( url );
}
else
osg::notify( osg::DEBUG_INFO ) << "Couldn't create CFURLRef for User's application support Path" << std::endl;
CFRelease( url );
url = NULL;
}
else
@ -702,11 +710,13 @@ std::string osgDB::findFileInDirectory(const std::string& fileName,const std::st
url = CFURLCreateFromFSRef( 0, &f );
if(url)
{
filepath.push_back(GetPathFromCFURLRef(url) + OSG_PLUGIN_PATH);
CFRelease( url );
}
else
osg::notify( osg::DEBUG_INFO ) << "Couldn't create CFURLRef for local System's ApplicationSupport Path" << std::endl;
CFRelease( url );
url = NULL;
}
else
@ -724,11 +734,13 @@ std::string osgDB::findFileInDirectory(const std::string& fileName,const std::st
url = CFURLCreateFromFSRef( 0, &f );
if(url)
{
filepath.push_back(GetPathFromCFURLRef(url) + OSG_PLUGIN_PATH);
CFRelease( url );
}
else
osg::notify( osg::DEBUG_INFO ) << "Couldn't create CFURLRef for network Application Support Path" << std::endl;
CFRelease( url );
url = NULL;
}
else