The code is not that compilable without Qt, VTK, ITK, and Cmake installed. It is publicly hosted at SourceForge:<div><a href="http://sourceforge.net/projects/glassbrain/">http://sourceforge.net/projects/glassbrain/</a></div>

<div><br></div><div>And the stack trace shows the problem arrises from the AddVertex call.<br><br><div class="gmail_quote">On Thu, May 13, 2010 at 2:25 PM, David Doria <span dir="ltr">&lt;<a href="mailto:daviddoria%2Bvtk@gmail.com">daviddoria+vtk@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="h5">On Thu, May 13, 2010 at 2:16 PM, Caleb Johnston &lt;<a href="mailto:cjj37@cornell.edu">cjj37@cornell.edu</a>&gt; wrote:<br>


&gt; I&#39;m getting a segfault when calling vtkMutableUndirectedGraph::AddVertex.<br>
&gt; However, it does not always occur at the same vertex. Sometimes it is after<br>
&gt; the 2nd vertex. Sometimes it won&#39;t happen at all (though rarely). I&#39;m only<br>
&gt; adding about 120 vertices. And the program is not consuming large amounts of<br>
&gt; data so I don&#39;t understand why this is happening. Also, this only happens in<br>
&gt; Linux and Windows but not MacOS X. Below, I have included my algorithm for<br>
&gt; adding vertices.<br>
&gt; thanks,<br>
&gt; Caleb<br>
&gt; ...<br>
&gt; int len = 0;<br>
&gt; double X,Y,Z,Count;<br>
&gt; for(i=0, j=0; j&lt;numberOfLabels; i+=3, j++){<br>
&gt;    X = (double)coords[i];<br>
&gt;    Y = (double)coords[i+1];<br>
&gt;    Z = (double)coords[i+2];<br>
&gt;    Count = (double)centroids[j];<br>
&gt;    if(Count&gt;0.0){<br>
&gt;       X = X / Count;<br>
&gt;       Y = Y / Count;<br>
&gt;       Z = Z / Count;<br>
&gt;       len++;<br>
&gt;       graph-&gt;AddVertex();  // crashes here.<br>
&gt;       graph-&gt;Update();<br>
&gt;       points-&gt;InsertNextPoint(X, Y, Z);<br>
&gt;    }<br>
&gt; }<br>
&gt; ...<br>
<br>
</div></div>I&#39;ve used this in Linux plenty of times with no problems. If you post<br>
some compilable code I can see if it works on my machine. My initial<br>
bet is that something is going wrong around there, like accessing out<br>
of bounds elements in coords or centroids.<br>
<br>
Thanks,<br>
<font color="#888888"><br>
David<br>
</font></blockquote></div><br></div>