forked from 0ad/0ad
# Fix possible GC crash bugs
This was SVN commit r7546.
This commit is contained in:
parent
a6600185ff
commit
ae08adc55d
@ -85,7 +85,8 @@ CScriptVal GuiInterfaceCall(void* cbdata, std::wstring name, CScriptVal data)
|
||||
if (g_Game && g_Game->GetLocalPlayer())
|
||||
player = g_Game->GetLocalPlayer()->GetPlayerID();
|
||||
|
||||
CScriptVal ret = gui->ScriptCall(player, name, sim->GetScriptInterface().CloneValueFromOtherContext(guiManager->GetScriptInterface(), data.get()));
|
||||
CScriptValRooted arg (sim->GetScriptInterface().GetContext(), sim->GetScriptInterface().CloneValueFromOtherContext(guiManager->GetScriptInterface(), data.get()));
|
||||
CScriptVal ret (gui->ScriptCall(player, name, arg.get()));
|
||||
return guiManager->GetScriptInterface().CloneValueFromOtherContext(sim->GetScriptInterface(), ret.get());
|
||||
}
|
||||
|
||||
|
@ -80,13 +80,10 @@ static jsval ConvertCParamNode(JSContext* cx, CParamNode const& val)
|
||||
|
||||
// Got child nodes - convert this node into a hash-table-style object:
|
||||
|
||||
ScriptInterface::LocalRootScope scope(cx);
|
||||
if (!scope.OK())
|
||||
return JSVAL_VOID; // TODO: report error
|
||||
|
||||
JSObject* obj = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
if (!obj)
|
||||
return JSVAL_VOID; // TODO: report error
|
||||
CScriptValRooted objRoot(cx, OBJECT_TO_JSVAL(obj));
|
||||
|
||||
for (std::map<std::string, CParamNode>::const_iterator it = children.begin(); it != children.end(); ++it)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user