Hi all,

I'm developing using ClanLib versione 1.0 since I still don't have time to make a migration to 2.0. In my game I created a class managin resource for different game phases. This class have two main function for load and unload resource from XML file as follow:

LoadResourcesFromXML(string XMLFile, string SurfaceSection)
{
......
CL_ResourceManager ResourceManager(XMLFile);

ResourceManager.load_section(SurfaceSection);

ResourceList = ResourceManager.get_resources_of_type(string("surf ace"), SurfaceSection);

for(iter = ResourceList.begin(); iter != ResourceList.end(); iter++)
{
string SurfaceName;

m_SurfaceList[SurfaceName] = new CL_Surface((*iter), &ResourceManager);
}

ResourceManager.unload_section(SurfaceSection);

.....
}

UnloadResourceFromMemory()
{
.....
if(m_SurfaceList.size() > 0)
{
hash_map<string, CL_Surface*>::iterator SurfaceIt;
for(SurfaceIt = m_SurfaceList.begin(); SurfaceIt != m_SurfaceList.end(); SurfaceIt++) delete SurfaceIt->second;
m_SurfaceList.clear();
}
.....
}

In my game there are three different sections and I allocate this class for every section loading the different resource connected to the right section. This mechanism work very well but the problem is that if I decide to call the UnloadResourceFromMemory() for only ONE of the three allocated class object (for free memory) also the other two sections doesnt work anymore and the draw surface function doesn't show any surface, I see only a black screen instead but, and this is the strage thing, the program continue to work like no problem exist. I'm checking the clanlib code but I can not find the reasons of this problem. Maybe I made a mistake in the way I unload the surfaces (delete SurfaceIt->second). Someone can help me?
Thank you