[vtkusers] Deleting unknown object: vtkObject - vector of pointers?
Bill Lorensen
bill.lorensen at gmail.com
Fri Nov 6 12:26:55 EST 2009
Ray is not initialized in the constructor. Do a
Ray=NULL;
Don't forget to Delete() Ray in the destructor.
On Fri, Nov 6, 2009 at 12:10 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
>
> On Fri, Nov 6, 2009 at 11:38 AM, Bill Lorensen <bill.lorensen at gmail.com>
> wrote:
>>
>> 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.
>
> Sorry to be such a pain about this...
>
> If the member variable IS a smart pointer, then does it do the
> register/unregister automatically? Is it recommended to have member
> variables as smart pointers or not? If you DO make the member variable a
> smart pointer, you must break the "don't include any headers but your
> superclass" rule. Is that allowed in this case?
>
> I switched to
> vtkSetObjectMacro(Ray, vtkRay);
> in an attempt to have it do the register/unregister automatically, but it
> simply segfaults when I call SetRay.
>
> The updated and simplified files are here:
> http://www.rpi.edu/~doriad/VTK_List/DeletingUnknownObject/
>
> 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