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