So... if I initialize the pointers the first time they are used, maybe that
will help. It makes sense that the _new routine would be causing the problem,
since it crashes when I load the object (PD disappears...)
I'll try it!
Ta,
Ed
Martin Peach <[EMAIL PROTECTED]> wrote: 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
> .
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> PD-dev mailing list
> PD-dev@iem.at
> http://lists.puredata.info/listinfo/pd-dev
>
Lone Shark "Aviation" out now on http://www.pyramidtransmissions.com
http://www.myspace.com/sharktracks
---------------------------------
Yahoo! Answers - Get better answers from someone who knows. Tryit now.
_______________________________________________
PD-dev mailing list
PD-dev@iem.at
http://lists.puredata.info/listinfo/pd-dev