I have code like this:

Code:
CL_ResourceManager *resources;
CL_Sprite *spr;

resources = new CL_ResourceManager("resources.xml");
spr = new CL_Sprite("SpriteFromResource", resources, gc);
Then I try to delete the sprite in application's destructor:

Code:
CL_Game::~CL_Game()
{
	if(spr)
		delete spr;

	if(resources)
		delete resources;
}
This results unhandled exception in mutex.cpp line 89 (EnterCriticalSection(&critical_section)). This also happens if I put "delete spr" in try block. This seems to happen only when I load sprite from resource file, not if I load sprite from image file.

Is this wrong way to delete sprites? What's the right way?