From cd650b30bd3ddfb9f71622278ef5b6f94ae27ac8 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 19 Jan 2024 12:52:41 +1100 Subject: fix some lua stack leaks + add a console func to help debug --- src/lua/property.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/lua/property.cpp') diff --git a/src/lua/property.cpp b/src/lua/property.cpp index 33600ee8..5357ccc5 100644 --- a/src/lua/property.cpp +++ b/src/lua/property.cpp @@ -113,6 +113,9 @@ PropertyBindings::PropertyBindings(lua_State& s) { // Add our binding funcs (get, set, bind) to the metatable. luaL_setfuncs(&s, kPropertyBindingFuncs, 0); + // We've finished setting up the metatable, so pop it. + lua_pop(&s, 1); + // Create a weak table in the registry to hold live bindings. lua_pushstring(&s, kBindingsTable); lua_newtable(&s); // bindings = {} @@ -368,6 +371,7 @@ auto Property::Update(const LuaValue& v) -> void { PushValue(*b.first); // push the argument CallProtected(b.first, 1, 0); // invoke the closure + lua_pop(b.first, 1); // pop the bindings table } } -- cgit v1.2.3