[Lldb-commits] [lldb] 4d7d6f2 - [LLDB/Lua] call lua_close() on Lua dtor

Pedro Tammela via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 2 08:53:54 PST 2020


Author: Pedro Tammela
Date: 2020-11-02T16:52:30Z
New Revision: 4d7d6f276c6df9e0a4cc3d9fccfaf84face62311

URL: https://github.com/llvm/llvm-project/commit/4d7d6f276c6df9e0a4cc3d9fccfaf84face62311
DIFF: https://github.com/llvm/llvm-project/commit/4d7d6f276c6df9e0a4cc3d9fccfaf84face62311.diff

LOG: [LLDB/Lua] call lua_close() on Lua dtor

This patch calls `lua_close()` on Lua dtor.

This guarantees that the Lua GC finalizers are honored, aside from the
usual internal clean up.

It also guarantees a call to the `__close` metamethod of any active
to-be-closed variable in Lua 5.4.

Since the previous `luaL_openlibs()` was a noop, because the standard
library is cached internally, I've removed it.

Differential Revision: https://reviews.llvm.org/D90557

Added: 
    

Modified: 
    lldb/source/Plugins/ScriptInterpreter/Lua/Lua.h

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.h b/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.h
index 300115aac8a7..ff055d0cbb9e 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.h
@@ -33,7 +33,7 @@ class Lua {
 
   ~Lua() {
     assert(m_lua_state);
-    luaL_openlibs(m_lua_state);
+    lua_close(m_lua_state);
   }
 
   llvm::Error Run(llvm::StringRef buffer);


        


More information about the lldb-commits mailing list