fix (maybe) the bad GC bug in luainterface?

This commit is contained in:
zeromus 2017-07-22 23:39:27 -05:00
parent 133d92cb6e
commit 759a4536a4
3 changed files with 20 additions and 1 deletions

View File

@ -618,6 +618,18 @@ namespace Lua511
static void lua_atunlock(IntPtr luaState, LuaCSFunction^ unlockf);
#endif
//zero 22-jul-2017
static int lua_pushthread(IntPtr luaState)
{
return ::lua_pushthread(((lua_State *)luaState.ToPointer()));
}
static void lua_xmove(IntPtr from, IntPtr to, int n)
{
::lua_xmove(((lua_State *)from.ToPointer()), ((lua_State *)to.ToPointer()),n);
}
static void lua_pushnumber(IntPtr luaState, double number)
{
::lua_pushnumber(toState, number);

View File

@ -68,7 +68,7 @@ namespace NLua
"-- Preload the mscorlib assembly \n"+
"luanet.load_assembly(\"mscorlib\") \n";
/*readonly */ IntPtr luaState;
/*readonly */ public IntPtr luaState; //zero 22-jul-2017 - made public
ObjectTranslator translator;
LuaCSFunction panicCallback, lockCallback, unlockCallback;

View File

@ -803,6 +803,13 @@ namespace NLua
{
((LuaFunction)o).push(luaState);
}
//zero 22-jul-2017
else if (o is Lua)
{
var lua = o as Lua;
LuaDLL.lua_pushnil(lua.luaState);
LuaDLL.lua_xmove(lua.luaState, luaState, 1);
}
else
{
pushObject(luaState,o,"luaNet_metatable");