mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-23 12:54:11 +00:00
The patch in 4b65f77438 seems to have fixed the crash, but the initData value doesn't match the JSContext's compartment, so it's theoretically wrong.
This should fix it correctly. #Refs 2241 This was SVN commit r14508.
This commit is contained in:
@@ -86,10 +86,12 @@ namespace {
|
||||
// Note that the initData argument may only contain clonable data.
|
||||
// Functions aren't supported for example!
|
||||
// TODO: Use LOGERROR to print a friendly error message when the requirements aren't met instead of failing with debug_warn when cloning.
|
||||
void PushGuiPage(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), std::wstring name, CScriptVal initData)
|
||||
void PushGuiPage(ScriptInterface::CxPrivate* pCxPrivate, std::wstring name, CScriptVal initData)
|
||||
{
|
||||
// TODO: we currently use the ScriptInterface of g_GUI. Check the comment in CGUIManager::SwitchPage for a detailed explanation.
|
||||
g_GUI->PushPage(name, g_GUI->GetScriptInterface()->WriteStructuredClone(initData.get()));
|
||||
// TODO: Check the comment in CGUIManager::SwitchPage for a detailed explanation of this hack.
|
||||
CScriptVal cloneSaveInitData;
|
||||
cloneSaveInitData = g_GUI->GetScriptInterface()->CloneValueFromOtherContext(*(pCxPrivate->pScriptInterface), initData.get());
|
||||
g_GUI->PushPage(name, g_GUI->GetScriptInterface()->WriteStructuredClone(cloneSaveInitData.get()));
|
||||
}
|
||||
|
||||
void SwitchGuiPage(ScriptInterface::CxPrivate* pCxPrivate, std::wstring name, CScriptVal initData)
|
||||
|
||||
Reference in New Issue
Block a user