1
0
forked from mirrors/0ad

Exact stack rooting for JSON related ScriptInterface functions.

Refs #2415
Refs #2462

This was SVN commit r15603.
This commit is contained in:
Yves
2014-08-02 22:21:50 +00:00
parent 15fa9e2c2e
commit a2bd44b23a
25 changed files with 151 additions and 79 deletions
@@ -89,12 +89,16 @@ public:
m_LocalQueue.push_back(c);
}
virtual void PostNetworkCommand(CScriptVal cmd)
virtual void PostNetworkCommand(CScriptVal cmd1)
{
JSContext* cx = GetSimContext().GetScriptInterface().GetContext();
JSAutoRequest rq(cx);
// TODO: With ESR31 we should be able to take JS::HandleValue directly
JS::RootedValue cmd(cx, cmd1.get());
PROFILE2_EVENT("post net command");
PROFILE2_ATTR("command: %s", GetSimContext().GetScriptInterface().StringifyJSON(cmd.get(), false).c_str());
PROFILE2_ATTR("command: %s", GetSimContext().GetScriptInterface().StringifyJSON(&cmd, false).c_str());
// TODO: would be nicer to not use globals
if (g_Game && g_Game->GetTurnManager())