From 6f5d6e9ba2c8aa8c1554d568bea903d028150d30 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 6 Feb 2020 08:39:47 +0100 Subject: [PATCH] Fix rt-safety of LuaProc w/o chanmapping Since Lua function arguments are not typed, there is no explicit "const", and a function can always modify the parameter. When passing `ChanMapping const&` as argument, the object is copy constructed. In this specific case the std::map<> members of ChanMapping allocate memory. Passing a pointer to the object works around this issue. LuaBridge later dereferences the object as needed when calling c++ methods, and copy-construction would only happen later. --- libs/ardour/luaproc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/ardour/luaproc.cc b/libs/ardour/luaproc.cc index e40127f7a5..d23995cef9 100644 --- a/libs/ardour/luaproc.cc +++ b/libs/ardour/luaproc.cc @@ -651,7 +651,7 @@ LuaProc::connect_and_run (BufferSet& bufs, try { if (_lua_does_channelmapping) { // run the DSP function - (*_lua_dsp)(&bufs, in, out, nframes, offset); + (*_lua_dsp)(&bufs, &in, &out, nframes, offset); } else { // map buffers BufferSet& silent_bufs = _session.get_silent_buffers (ChanCount (DataType::AUDIO, 1));