<div class="gmail_quote">On Fri, Nov 6, 2009 at 8:27 AM, Bill Lorensen <span dir="ltr">&lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
David,<br>
<br>
<br>
Try printing the reference count of each LidarPoint before and after<br>
std::cout &lt;&lt; &quot;Ref Before: &quot; &lt;&lt; LidarPoint-&gt;GetReferenceCount() &lt;&lt; std::endl;<br>
Column[phiCounter] = LidarPoint;<br>
std::cout &lt;&lt; &quot;Ref After: &quot; &lt;&lt; LidarPoint-&gt;GetReferenceCount() &lt;&lt; std::endl;<br>
<br>
And outside the end of the inner loop:<br>
std::cout &lt;&lt; &quot;Ref outside loop: &quot; &lt;&lt;<br>
OutputGrid[0]-.GetReferenceCount() &lt;&lt; std::endl;<br>
<div><div></div><div class="h5"><br>
</div></div></blockquote><div><br>Both before and after 
Column[phiCounter] = LidarPoint;, the reference count is 1. <br><br>I changed<br>vtkstd::vector&lt;vtkLidarPoint*&gt; Column;<br>to<br>vtkstd::vector&lt;vtkSmartPointer&lt;vtkLidarPoint&gt; &gt; Column;<br>so that the reference count increases to 2 after Column[phiCounter] = LidarPoint;<br>
<br>I also changed<br>vtkstd::vector&lt;vtkstd::vector&lt;vtkLidarPoint*&gt; &gt; OutputGrid;<br>to<br>vtkstd::vector&lt;vtkstd::vector&lt;vtkSmartPointer&lt;vtkLidarPoint&gt; &gt; &gt; OutputGrid;<br>based on the same logic.<br>
<br>I now get many less errors, but I still get a single <br>Deleting unknown object: vtkObject<br>every time the inner loop is entered.<br><br>I&#39;m assuming it is because the vtkRay is going out of scope at the end of the loop and I haven&#39;t made LidarPoint::SetRay accept a smart pointer? <br>
<br>Is all of this the correct way to approach storing these objects?<br><br clear="all">Thanks,<br><br>David <br></div></div>