forked from 0ad/0ad
Fixes small memory leak introduced in 28bdd8540f
.
Thanks to leper for pointing it out. This was SVN commit r15569.
This commit is contained in:
parent
28bdd8540f
commit
64efbfeae3
@ -82,6 +82,13 @@ bool CMapGeneratorWorker::Run()
|
||||
JSContext* cx = m_ScriptInterface->GetContext();
|
||||
JSAutoRequest rq(cx);
|
||||
|
||||
// We must destroy the ScriptInterface in the same thread because the JSAPI requires that!
|
||||
struct AutoFree {
|
||||
AutoFree(ScriptInterface* p) : m_p(p) {}
|
||||
~AutoFree() { SAFE_DELETE(m_p); }
|
||||
ScriptInterface* m_p;
|
||||
} autoFree(m_ScriptInterface);
|
||||
|
||||
m_ScriptInterface->SetCallbackData(static_cast<void*> (this));
|
||||
|
||||
// Replace RNG with a seeded deterministic function
|
||||
@ -132,9 +139,6 @@ bool CMapGeneratorWorker::Run()
|
||||
return false;
|
||||
}
|
||||
|
||||
// We must destroy the ScriptInterface in the same thread because the JSAPI requires that!
|
||||
SAFE_DELETE(m_ScriptInterface);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user