Ed Kelly wrote:
Hi devs,
I'm trying to rewrite some of my externals to be a bit more effe\icient, clear up after themselves and generally work more smoothly. I started with maskxor, because I really need this to work for the ICMC, and it's not working properly in certain situations.
So I borrowed some code from zexy/src/drip.c and rewrote it. It compiled OK, but crashes PD. Can anyone tell me what is wrong with my code, and how to fix it?
I guess because you don't initialize the pointers the first time. Your maskxor_new has:
SETFLOAT(&x->masking.maskr[0], 0); SETFLOAT(&x->masking.maskl[0], 0); SETFLOAT(&x->masking.maskxor[0], 0); ...but x->masking.maskr etc. don't yet point to anything, they were declared as: t_atom *maskxor, *maskl, *maskr; ...but not given any value. If it doesn't crash right there it will do so when you try to free the pointers: if (x->masking.maskl) { freebytes(x->masking.maskl, x->lengthl * sizeof(t_atom)); x->masking.maskl = 0; x->lengthl = 0; } Martin
Best, Ed
Lone Shark "Aviation" out now on http://www.pyramidtransmissions.com http://www.myspace.com/sharktracks
Yahoo! Answers - Get better answers from someone who knows. Try it now http://uk.answers.yahoo.com/;_ylc=X3oDMTEydmViNG02BF9TAzIxMTQ3MTcxOTAEc2VjA21haWwEc2xrA3RhZ2xpbmU.
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev