[Lldb-commits] [PATCH] D90557: [LLDB/Lua] call lua_close() on Lua dtor

Pedro Tammela via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Nov 1 10:14:14 PST 2020


tammela created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
tammela requested review of this revision.
Herald added a subscriber: JDevlieghere.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90557

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


Index: lldb/source/Plugins/ScriptInterpreter/Lua/Lua.h
===================================================================
--- lldb/source/Plugins/ScriptInterpreter/Lua/Lua.h
+++ lldb/source/Plugins/ScriptInterpreter/Lua/Lua.h
@@ -33,7 +33,7 @@
 
   ~Lua() {
     assert(m_lua_state);
-    luaL_openlibs(m_lua_state);
+    lua_close(m_lua_state);
   }
 
   llvm::Error Run(llvm::StringRef buffer);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90557.302153.patch
Type: text/x-patch
Size: 398 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201101/b35b7238/attachment.bin>


More information about the lldb-commits mailing list