[vtk-developers] Do I need to delete an object when I create a smart pointer of it?

Jorge Perez josp.jorge at gmail.com
Sun Mar 29 12:06:35 EDT 2015


Hi, you can read here about that topic
http://www.vtk.org/Wiki/VTK/Tutorials/SmartPointers

HTH

2015-03-29 18:00 GMT+02:00 Mingcheng Chen <linyufly at gmail.com>:

> Hello,
>
> I am always prudent when using VTK, i. e. I never mix the smart pointer
> and normal pointer of VTK objects.
>
> I have a concern. Suppose we have
>
> vtkPolyData *mesh = some_function_which_returns_vtkPolyData_star(...);
> vtkSmartPointer<vtkPolyData> mesh_ptr = vtkSmartPointer<vtkPolyData>(mesh);
>
> we should do mesh_ptr->Delete() after, right?
>
> However, can we do
>
> vtkSmartPointer<vtkPolyData> mesh_ptr =
> vtkSmartPointer<vtkPolyData>(some_function_which_returns_vtkPolyData_star(...));
>
> ?
>
> If we do that, how can we delete the reference count to the object before
> passing it to vtkSmartPointer?
>
> Thanks!
>
> -Mingcheng
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150329/e130bbb4/attachment.html>


More information about the vtk-developers mailing list