<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">As your code is written now, you are telling the array to store raw<br>

pointers; it does not even know that the pointers are vtkObject<br>
subclasses, so it does not know it should increment the reference<br>
count. The correct way to make this &quot;just work&quot; is to define the<br>
storage container as<br>
<br>
vtkSmartPointer&lt;vtkDenseArray&lt;vtkSmartPointer&lt;vtkRay&gt; &gt; &gt; array = ...<br>
<br>
Of course you may need to do some trickery for allowing<br>
vtkSmartPointer&lt;vtkRay&gt; to be converted to a vtkVariant. Similarly, a<br>
nice way to store vtkObject classes in a std::vector (or any other STL<br>
storage container) is with:<br>
<br>
std::vector&lt;vtkSmartPointer&lt;vtkRay&gt; &gt; array;<br>
...<br>
array[i] = vtkSmartPointer&lt;vtkRay&gt;::New();<br>
<br>
This will automatically keep a reference count for each object in the<br>
array until the array is destructed.<br>
<font color="#888888"><br>
Jeff<br>
</font></blockquote><br>
</div>I had to add<br>
<br>
#include &quot;vtkVariant.h&quot;<br>
<br>
and <br>
<br>
 operator vtkVariant() const { return vtkVariant(); }<br>
<br>
to vtkSmartPointer.h<br>
<br>
Jeff, is there anyway you can commit those changes so this will work for everyone?<br>
<br clear="all">Thanks,<br><br>David<br>
<br>