13
0

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.
This commit is contained in:
Robin Gareus 2020-02-06 08:39:47 +01:00
parent 01a75c04b1
commit 6f5d6e9ba2
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

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