<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 "just work" is to define the<br>
storage container as<br>
<br>
vtkSmartPointer<vtkDenseArray<vtkSmartPointer<vtkRay> > > array = ...<br>
<br>
Of course you may need to do some trickery for allowing<br>
vtkSmartPointer<vtkRay> 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<vtkSmartPointer<vtkRay> > array;<br>
...<br>
array[i] = vtkSmartPointer<vtkRay>::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 "vtkVariant.h"<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>