forked from mirrors/0ad
Exact stack rooting for ScriptInterface::ToString.
I had to change a few other functions to take JS::MutableHandleValue because JS::Stringify takes a JS::MutableHandleValue as input parameter. That seems a bit strange because it should not change that value. I assume it has historical reasons. Refs #2415 Refs #2462 This was SVN commit r15605.
This commit is contained in:
@@ -185,13 +185,16 @@ void CNetClient::PushGuiMessage(const CScriptValRooted& message)
|
||||
|
||||
std::wstring CNetClient::TestReadGuiMessages()
|
||||
{
|
||||
JSContext* cx = GetScriptInterface().GetContext();
|
||||
JSAutoRequest rq(cx);
|
||||
|
||||
std::wstring r;
|
||||
while (true)
|
||||
{
|
||||
CScriptValRooted msg = GuiPoll();
|
||||
if (msg.undefined())
|
||||
JS::RootedValue msg(cx, GuiPoll().get());
|
||||
if (msg.isUndefined())
|
||||
break;
|
||||
r += GetScriptInterface().ToString(msg.get()) + L"\n";
|
||||
r += GetScriptInterface().ToString(&msg) + L"\n";
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user