Fixes a crash introduced in fd187f466f by ensuring that the CScriptValRooted values are destroyed before calling JS_DestroyContext.

I've tested the performance on Combat Demo (Huge) again with the code
from #2394.
It's very close but probably a little bit lower (hard to tell because
it's so close).

Closes #2408
Refs #2394

This was SVN commit r14705.
This commit is contained in:
Yves
2014-01-30 13:21:36 +00:00
parent b9eea330d0
commit bab3a08643
3 changed files with 19 additions and 6 deletions
@@ -165,7 +165,7 @@ template<> jsval ScriptInterface::ToJSVal<CFixedVector3D>(JSContext* cx, const C
{
// apply the Vector3D prototype to the return value;
ScriptInterface::CxPrivate* pCxPrivate = ScriptInterface::GetScriptInterfaceAndCBData(cx);
JSObject* obj = JS_NewObject(cx, NULL, JSVAL_TO_OBJECT(pCxPrivate->pScriptInterface->vector3Dprototype.get()), NULL);
JSObject* obj = JS_NewObject(cx, NULL, JSVAL_TO_OBJECT(pCxPrivate->pScriptInterface->GetCachedValue(ScriptInterface::CACHE_VECTOR3DPROTO).get()), NULL);
if (!obj)
return JSVAL_VOID;
@@ -202,7 +202,7 @@ template<> jsval ScriptInterface::ToJSVal<CFixedVector2D>(JSContext* cx, const C
{
// apply the Vector2D prototype to the return value
ScriptInterface::CxPrivate* pCxPrivate = ScriptInterface::GetScriptInterfaceAndCBData(cx);
JSObject* obj = JS_NewObject(cx, NULL, JSVAL_TO_OBJECT(pCxPrivate->pScriptInterface->vector2Dprototype.get()), NULL);
JSObject* obj = JS_NewObject(cx, NULL, JSVAL_TO_OBJECT(pCxPrivate->pScriptInterface->GetCachedValue(ScriptInterface::CACHE_VECTOR2DPROTO).get()), NULL);
if (!obj)
return JSVAL_VOID;