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);


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);
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH] ... Pedro Tammela via Phabricator via lldb-commits

Reply via email to