Attempts to fix incorrect destructor order in random map generator. See #1037, #1035.

This was SVN commit r10627.
This commit is contained in:
historic_bruno 2011-11-29 00:14:34 +00:00
parent 774c9e63e6
commit ee417e8fd0
2 changed files with 9 additions and 12 deletions

View File

@ -37,6 +37,13 @@ CMapGeneratorWorker::~CMapGeneratorWorker()
{
// Wait for thread to end
pthread_join(m_WorkerThread, NULL);
// The StructuredClone destructor references a JSContext created by our
// ScriptInterface, so explicitly clean it up before ScriptInterface
m_MapData.reset();
// Cleanup ScriptInterface
delete m_ScriptInterface;
}
void CMapGeneratorWorker::Initialize(const VfsPath& scriptFile, const std::string& settings)
@ -73,9 +80,6 @@ void* CMapGeneratorWorker::RunThread(void *data)
// and can die. The data will be stored in m_MapData already if successful, or m_Progress
// will contain an error value on failure.
// Cleanup ScriptInterface
SAFE_DELETE(self->m_ScriptInterface);
return NULL;
}

View File

@ -1391,13 +1391,6 @@ int CMapReader::ParseCamera()
CMapReader::~CMapReader()
{
// Cleaup objects
if (xml_reader)
{
delete xml_reader;
}
if (m_MapGen)
{
delete m_MapGen;
}
}