From 01588f267fe9725ea6bf0baffcf733320bcf9a46 Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Mon, 9 May 2005 03:26:04 +0000 Subject: [PATCH] Corrected garbage collection problem This was SVN commit r2255. --- source/ps/GameAttributes.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/ps/GameAttributes.cpp b/source/ps/GameAttributes.cpp index 6ce67bfc9a..46196c546a 100644 --- a/source/ps/GameAttributes.cpp +++ b/source/ps/GameAttributes.cpp @@ -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()