From 6b3f25eb2ac275cf1768e9ef125daa9750908f40 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 4 Oct 2023 01:25:04 +0200 Subject: [PATCH] Update Lua instances (2/4) This is effectively a NO-OP. --- libs/ardour/luaproc.cc | 6 ++---- libs/ardour/luascripting.cc | 12 ++++-------- libs/ardour/session.cc | 1 - luasession/luasession.cc | 4 ++-- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/libs/ardour/luaproc.cc b/libs/ardour/luaproc.cc index dce4d6ea88..b5109567fd 100644 --- a/libs/ardour/luaproc.cc +++ b/libs/ardour/luaproc.cc @@ -51,7 +51,7 @@ LuaProc::LuaProc (AudioEngine& engine, #ifdef USE_TLSF , lua (lua_newstate (&PBD::TLSF::lalloc, &_mempool)) #elif defined USE_MALLOC - , lua () + , lua (true, true) #else , lua (lua_newstate (&PBD::ReallocPool::lalloc, &_mempool)) #endif @@ -87,7 +87,7 @@ LuaProc::LuaProc (const LuaProc &other) #ifdef USE_TLSF , lua (lua_newstate (&PBD::TLSF::lalloc, &_mempool)) #elif defined USE_MALLOC - , lua () + , lua (true, true) #else , lua (lua_newstate (&PBD::ReallocPool::lalloc, &_mempool)) #endif @@ -176,8 +176,6 @@ LuaProc::init () luabridge::push (L, this); lua_setglobal (L, "self"); - // sandbox - lua.sandbox (true); #if 0 lua.do_command ("for n in pairs(_G) do print(n) end print ('----')"); // print global env #endif diff --git a/libs/ardour/luascripting.cc b/libs/ardour/luascripting.cc index bf26074011..1d51afb2e6 100644 --- a/libs/ardour/luascripting.cc +++ b/libs/ardour/luascripting.cc @@ -184,7 +184,7 @@ LuaScripting::lua_print (std::string s) { LuaScriptInfoPtr LuaScripting::scan_script (const std::string &fn, const std::string &sc) { - LuaState lua; + LuaState lua (true, true); if (!(fn.empty() ^ sc.empty())){ // give either file OR script assert (0); @@ -193,7 +193,6 @@ LuaScripting::scan_script (const std::string &fn, const std::string &sc) lua_State* L = lua.getState(); lua.Print.connect (&LuaScripting::lua_print); - lua.sandbox (true); lua.do_command ( "ardourluainfo = {}" @@ -392,7 +391,7 @@ LuaScriptParams::script_params (const LuaScriptInfoPtr& lsi, const std::string & LuaScriptParamList LuaScriptParams::script_params (const std::string& s, const std::string &pname, bool file) { - LuaState lua; + LuaState lua (true, true); return LuaScriptParams::script_params (lua, s, pname, file); } @@ -402,7 +401,6 @@ LuaScriptParams::script_params (LuaState& lua, const std::string& s, const std:: LuaScriptParamList rv; lua_State* L = lua.getState(); - lua.sandbox (true); lua.do_command ("function ardour () end"); try { @@ -481,9 +479,8 @@ LuaScripting::try_compile (const std::string& script, const LuaScriptParamList& if (bytecode.empty()) { return false; } - LuaState l; + LuaState l (true, true); l.Print.connect (&LuaScripting::lua_print); - l.sandbox (true); lua_State* L = l.getState(); l.do_command ("" @@ -520,9 +517,8 @@ LuaScripting::try_compile (const std::string& script, const LuaScriptParamList& std::string LuaScripting::get_factory_bytecode (const std::string& script, const std::string& ffn, const std::string& fp) { - LuaState l; + LuaState l (true, true); l.Print.connect (&LuaScripting::lua_print); - l.sandbox (true); lua_State* L = l.getState(); l.do_command ( diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index eb0282aea3..639683b30c 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -5309,7 +5309,6 @@ void Session::setup_lua () { lua.Print.connect (&_lua_print); - lua.sandbox (true); lua.do_command ( "function ArdourSession ()" " local self = { scripts = {}, instances = {} }" diff --git a/luasession/luasession.cc b/luasession/luasession.cc index 2dee838073..37a4d53ffe 100644 --- a/luasession/luasession.cc +++ b/luasession/luasession.cc @@ -416,7 +416,7 @@ setup_lua () { assert (!lua); - lua = new LuaState (); + lua = new LuaState (false, false); lua->Print.connect (&my_lua_print); lua_State* L = lua->getState (); @@ -491,7 +491,7 @@ interactive_interpreter () } do { - LuaState lt; + LuaState lt (false, false); lua_State* L = lt.getState (); int status = luaL_loadbuffer (L, line, strlen (line), "=stdin"); if (!incomplete (L, status)) {