Corrected garbage collection problem
This was SVN commit r2255.
This commit is contained in:
parent
bcc4aea8dc
commit
01588f267f
@ -189,6 +189,7 @@ CGameAttributes::CGameAttributes():
|
||||
);
|
||||
|
||||
m_PlayerSlotArrayJS=g_ScriptingHost.CreateCustomObject("PlayerSlotArray");
|
||||
JS_AddRoot(g_ScriptingHost.GetContext(), &m_PlayerSlotArrayJS);
|
||||
JS_SetPrivate(g_ScriptingHost.GetContext(), m_PlayerSlotArrayJS, this);
|
||||
|
||||
AddSynchedProperty(L"mapFile", &m_MapFile);
|
||||
@ -250,6 +251,8 @@ CGameAttributes::~CGameAttributes()
|
||||
// this feels rather unpleasantly inconsistent with the above code, so maybe
|
||||
// there's a better way to avoid the memory leak.
|
||||
delete m_Players[0];
|
||||
|
||||
JS_RemoveRoot(g_ScriptingHost.GetContext(), &m_PlayerSlotArrayJS);
|
||||
}
|
||||
|
||||
void CGameAttributes::ScriptingInit()
|
||||
|
Loading…
Reference in New Issue
Block a user