[vtkusers] Deleting unknown object: vtkObject - vector of pointers?

David Doria daviddoria+vtk at gmail.com
Fri Nov 6 11:04:07 EST 2009


On Fri, Nov 6, 2009 at 10:27 AM, Bill Lorensen <bill.lorensen at gmail.com>wrote:

> Does SetRay increment the reference count of the Ray? Using
> this->Ray->Register(this)
>
> I tried your example with two vtk objects and it worked as expected.
>
> Bill
>

My member variable was not a smart pointer:
vtkRay* Ray;

Should it be?

My SetRay function was:
void vtkLidarPoint::SetRay(vtkRay* R)
{
  this->Ray->DeepCopy(R);
}

I got rid of the deep copy and changed it to accept a smart pointer and to
register the pointer to the ray with the LidarPoint object. However, I still
get the "Deleting unknown object" errors.

Here is the smallest extracted version that demonstrates the problem:
http://www.rpi.edu/~doriad/VTK_List/DeletingUnknownObject/

I actually think this is a very good example to demonstrate a lot of these
smart pointer issues all in one shot. If you guys can help me try to get a
handle on this I'll try to improve the smart pointer tutorial I started.

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091106/c54258cc/attachment.htm>


More information about the vtkusers mailing list