re-apply "keepalive" GC fixes to luainterface mode in emuhawk; maybe it will actually work now and not result in crashes. at least we should check it.

This commit is contained in:
zeromus 2017-07-22 23:41:12 -05:00
parent abcf627e24
commit d5770fb8a3
2 changed files with 4 additions and 4 deletions

View File

@ -49,7 +49,7 @@
public void Stop()
{
State = RunState.Disabled;
if(NLua.Lua.WhichLua == "NLua")
//if(NLua.Lua.WhichLua == "NLua")
Thread.GetTable("keepalives")[Thread] = null;
Thread = null;
}

View File

@ -18,7 +18,7 @@ namespace BizHawk.Client.EmuHawk
public EmuLuaLibrary()
{
Docs = new LuaDocumentation();
if(NLua.Lua.WhichLua == "NLua")
//if(NLua.Lua.WhichLua == "NLua")
_lua["keepalives"] = _lua.NewTable();
}
@ -178,7 +178,7 @@ namespace BizHawk.Client.EmuHawk
var content = File.ReadAllText(file);
var main = lua.LoadString(content, "main");
lua.Push(main); // push main function on to stack for subsequent resuming
if (NLua.Lua.WhichLua == "NLua")
//if (NLua.Lua.WhichLua == "NLua")
{
_lua.GetTable("keepalives")[lua] = 1;
//this not being run is the origin of a memory leak if you restart scripts too many times
@ -191,7 +191,7 @@ namespace BizHawk.Client.EmuHawk
{
_currThread = _lua.NewThread();
_currThread.DoString(command);
if (NLua.Lua.WhichLua == "NLua")
//if (NLua.Lua.WhichLua == "NLua")
_lua.Pop();
}