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 &lt;martin.peach@sympatico.ca&gt;</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>&gt; Hi devs,<br>&gt;<br>&gt; I'm trying to rewrite some of my externals to be a bit more <br>&gt; effe\icient, clear up after themselves and generally work more <br>&gt; smoothly. I started with maskxor, because I really need this to work <br>&gt; for the ICMC, and it's not working properly in certain situations.<br>&gt;<br>&gt; So I borrowed some code from zexy/src/drip.c and rewrote it. It <br>&gt; compiled OK, but crashes PD. Can anyone tell me what is wrong with my <br>&gt; code, and how to fix it?<br>&gt;<br>I guess because
 you don't initialize the pointers the first time. Your <br>maskxor_new has:<br> <br>  SETFLOAT(&amp;x-&gt;masking.maskr[0], 0);<br>  SETFLOAT(&amp;x-&gt;masking.maskl[0], 0);<br>  SETFLOAT(&amp;x-&gt;masking.maskxor[0], 0);<br>...but x-&gt;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-&gt;masking.maskl) {<br>    freebytes(x-&gt;masking.maskl, x-&gt;lengthl * sizeof(t_atom));<br>    x-&gt;masking.maskl = 0;<br>    x-&gt;lengthl = 0;<br>  }<br>Martin<br><br>&gt; Best,<br>&gt; Ed<br>&gt;<br>&gt;<br>&gt; Lone Shark "Aviation" out now on http://www.pyramidtransmissions.com<br>&gt; http://www.myspace.com/sharktracks<br>&gt;<br>&gt; ------------------------------------------------------------------------<br>&gt; Yahoo! Answers - Get better answers from someone who knows. Try it now <br>&gt;
 <http: uk.answers.yahoo.com="" ;_ylc="X3oDMTEydmViNG02BF9TAzIxMTQ3MTcxOTAEc2VjA21haWwEc2xrA3RhZ2xpbmU">. <br>&gt;<br>&gt; ------------------------------------------------------------------------<br>&gt;<br>&gt; _______________________________________________<br>&gt; PD-dev mailing list<br>&gt; PD-dev@iem.at<br>&gt; http://lists.puredata.info/listinfo/pd-dev<br>&gt;   <br><br></http:></blockquote><br><BR><BR>Lone Shark "Aviation" out now on http://www.pyramidtransmissions.com<br>http://www.myspace.com/sharktracks<p>&#32;
      <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>.