Unconnected signal crash
Hello,
I am having a problem whereby if I do not connect a signal to the inlet of an external I get (not entirely reliable) bad access crashes as soon as I try to access the input. I have been labouring for quite some time under the assumption that the dsp is always handed valid signal pointers, whether they are connected or otherwise, could someone confirm this?
I'm finding it hard to debug, partly because a couple of the variables (including the input) are always showing as out of scope in XCode, even when it is functioning correctly, and under debug build. Anyway, the line of code is so simple that there must be some pointer issue, but I never have a problem when the input is connected....
Anyone shed any light on the matter?
Thanks
Alex
Regardless of whether or not a signal is connected, you should have a valid signal pointer provided in your DSP method. Without more information (e.g. your dsp and perform methods) we can't offer more help.
OK - thanks - it's a big file that uses two big headers. It's almost certainly my fault in that case - that was what I needed to know - I'll investigate more.....
Alex
OK - I've looked some more at this and I *think* I may have it...
A while back (couple of years) I asked if signals could be 16byte aligned again and more recently it was done (maybe 8 months ago), which I was grateful for indeed.
It looks like unconnected signals may be valid, but not 16 byte aligned, which is a tiny bit of a pain for me, although I can live with it. That would explain why all my externals were working whilst fully patched, but this thing I'm getting now is happening (I'm treating the input block as 16 byte aligned).
Is that plausible? Could it be confirmed? Any chance it could be changed?
Thanks
Alex
Also, I don't see any issues yet with unaligned unconnected outlets, only inputs.
Be good to know if this is to be expected or not, as the workaround is easier for inputs only, but I'd like to be sure I'm properly avoiding crashes.
to play it safe, you can check the (short *)count array provided as the second argument to the dsp method, to see if a signal is connected or not.
Thanks mudang - Yeah - I know that - that's the workaround I've just implemented. Unfortunately, although it may be obvious what to do it a single in / out scenario - it is more complicated for multiple ins and outs, when the right thing to do is to correctly calculate from some inputs / to some outputs, but others may crash.
Anyway, if outputs are not a problem then I might be ok, as I'm only dealing with one input at the moment...
Alex
Thanks for the report Alex. This will be fixed in the next release.
-Joshua
Many thanks!