Skip to content

Commit b1160a7

Browse files
authored
Merge pull request pangweiwei#259 from hustwenchao/master
fix bug : gc auto collect LuaCSFunction
2 parents b1c25c2 + 849fbf0 commit b1160a7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Assets/Plugins/Slua_Managed/LuaVarObject.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,8 @@ static public int methodWrapper(IntPtr l)
528528
LuaDLL.lua_createtable(l, 0, 1);
529529
pushValue(l, methodWrapper);
530530
LuaDLL.lua_setfield(l, -2, "__call");
531+
LuaDLL.lua_pushcfunction(l, lua_gc);
532+
LuaDLL.lua_setfield(l, -2, "__gc");
531533
LuaDLL.lua_setfield(l, LuaIndexes.LUA_REGISTRYINDEX, ObjectCache.getAQName(typeof(LuaCSFunction)));
532534
}
533535
}

0 commit comments

Comments
 (0)