[vtkusers] Deleting unknown object: vtkObject - vector of pointers?
Bill Lorensen
bill.lorensen at gmail.com
Fri Nov 6 11:38:33 EST 2009
Your member variable does not have to be a smartpointer. If it is not,
you'll have to Register it on a Set. And UnRegister on destruction.
If you use the vtkSetObject macro, it will do the proper
register/unregister. You will still have to UnRegister in the the
descturcotr if it is not null.
On Fri, Nov 6, 2009 at 11:04 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
>
> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
More information about the vtkusers
mailing list