Commit 582e83b3 authored by Hanspeter Portner's avatar Hanspeter Portner

fix userdata garbage collection in c?xc?.

parent 8696819f
......@@ -3,4 +3,3 @@
* api: xpress
* gui: clipboard support
* gui: external editor
* dsp: fix c?xc? crashing in carla
......@@ -127,7 +127,7 @@ _run_period(lua_State *L, const char *cmd, Handle *handle, uint32_t nsamples,
lforge->last.frames = 0;
lforge->forge = &handle->forge[i];
}
lua_call(L, 1 + 2*handle->max_val + 2, 0);
}
}
......
......@@ -69,7 +69,7 @@ instantiate(const LV2_Descriptor* descriptor, double rate, const char *bundle_pa
handle->max_val = 4;
else
handle->max_val = 1;
lv2_atom_forge_init(&handle->forge, handle->moony.map);
for(unsigned i=0; i<2; i++)
......@@ -126,7 +126,7 @@ _run_period(lua_State *L, const char *cmd, Handle *handle, uint32_t nsamples,
latom_t *latom = moony_newuserdata(L, &handle->moony, MOONY_UDATA_ATOM, true);
latom->atom = (const LV2_Atom *)event_in;
latom->body.raw = LV2_ATOM_BODY_CONST(latom->atom);
lforge_t *lforge = moony_newuserdata(L, &handle->moony, MOONY_UDATA_FORGE, true);
lforge->depth = 0;
lforge->last.frames = 0;
......@@ -276,6 +276,11 @@ run(LV2_Handle instance, uint32_t nsamples)
else
lv2_atom_forge_pop(&handle->forge, &frame);
// clear output ports upon error
if(moony_bypass(&handle->moony))
for(unsigned i=0; i<handle->max_val; i++)
*handle->val_out[i] = 0.f;
// handle UI comm
moony_out(&handle->moony, handle->notify, nsamples - 1);
}
......
......@@ -190,7 +190,7 @@ run(LV2_Handle instance, uint32_t nsamples)
if(lua_pcall(L, 0, 0, 0))
moony_error(&handle->moony);
//moony_freeuserdata(&handle->moony);
moony_freeuserdata(&handle->moony);
#ifdef USE_MANUAL_GC
lua_gc(L, LUA_GCSTEP, 0);
#endif
......@@ -209,7 +209,7 @@ run(LV2_Handle instance, uint32_t nsamples)
else
{
// stash incoming events to later apply
lock_stash_t *stash = &handle->stash;
LV2_ATOM_SEQUENCE_FOREACH(handle->control, ev)
{
......@@ -220,7 +220,7 @@ run(LV2_Handle instance, uint32_t nsamples)
}
handle->stash_nsamples += nsamples;
handle->stashed= true;
handle->stashed = true;
}
// clear output ports upon error
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment