Oops, I broke it. Fixed by reinserting memory leak.

This was SVN commit r2596.
This commit is contained in:
Ykkrosh 2005-08-10 01:27:33 +00:00
parent 622ceeda94
commit cd4273cd16
2 changed files with 14 additions and 25 deletions

View File

@ -109,22 +109,15 @@ void CTextureManager::LoadTextures(CTerrainProperties *props, CStr path, const c
// Has XML file -> attempt to load properties
if (vfs_exists(xmlname.c_str()))
myprops=GetPropertiesFromFile(props, xmlname);
CTerrainProperties *usedProps = NULL;
if (myprops)
{
LOG(NORMAL, LOG_CATEGORY, "CTextureManager: Successfully loaded override xml %s for texture %s\n", xmlname.c_str(), dent.name);
usedProps = myprops;
}
else
{
// Error or non-existant xml file -> use parent props
usedProps = props;
}
AddTexture(usedProps, path+dent.name);
delete myprops;
if (myprops)
LOG(NORMAL, LOG_CATEGORY, "CTextureManager: Successfully loaded override xml %s for texture %s\n", xmlname.c_str(), dent.name);
// Error or non-existant xml file -> use parent props
if (!myprops)
myprops = props;
AddTexture(myprops, path+dent.name);
}
vfs_dir_close(dir);
@ -136,17 +129,14 @@ void CTextureManager::RecurseDirectory(CTerrainProperties *parentProps, CStr pat
LOG(NORMAL, LOG_CATEGORY, "CTextureManager::RecurseDirectory(%s)", path.c_str());
// Load terrains.xml first, if it exists
CTerrainProperties *loadedProps=NULL;
CTerrainProperties *props=NULL;
CStr xmlpath=path+"terrains.xml";
if (vfs_exists(xmlpath.c_str()))
loadedProps=GetPropertiesFromFile(parentProps, xmlpath);
props=GetPropertiesFromFile(parentProps, xmlpath);
CTerrainProperties *props=NULL;
if (loadedProps)
props = loadedProps;
else
// No terrains.xml, or read failures -> use parent props (i.e.
if (!props)
{
// No terrains.xml, or read failures -> use parent props
LOG(NORMAL, LOG_CATEGORY,
"CTextureManager::RecurseDirectory(%s): no terrains.xml (or errors while loading) - using parent properties", path.c_str());
props = parentProps;
@ -171,8 +161,6 @@ void CTextureManager::RecurseDirectory(CTerrainProperties *parentProps, CStr pat
{
LoadTextures(props, path, SupportedTextureFormats[i]);
}
delete loadedProps;
}

View File

@ -129,7 +129,8 @@ int pthread_key_create(pthread_key_t* key, void (*dtor)(void*))
*key = (pthread_key_t)idx;
// acquire a free dtor slot
for(uint i = 0; i < MAX_DTORS; i++)
uint i;
for(i = 0; i < MAX_DTORS; i++)
{
if(CAS(&dtors[i].dtor, 0, dtor))
goto have_slot;