[vtkusers] Deleting vtkImageWriter

David Doria daviddoria+vtk at gmail.com
Wed Apr 21 08:22:28 EDT 2010


On Wed, Apr 21, 2010 at 12:44 AM, Gib Bogle <g.bogle at auckland.ac.nz> wrote:
> This is probably a dumb question.
>
> Why is it that although this works fine
>
> vtkSmartPointer<vtkTIFFWriter> tifwriter =
> tkSmartPointer<vtkTIFFWriter>::New();
> tifwriter->SetInputConnection(w2img->GetOutputPort());
> w2img->Modified();
> tifwriter->SetFileName("zzz.tif");
> tifwriter->Write();
>
> if I attempt then to delete tifwriter with
> tifwriter->Delete();
>
> the program crashes?  Is it not necessary to delete the writer?

If you use smart pointers, you cannot (and do not need to) delete the
objects manually.

Take a look through this:

http://www.vtk.org/Wiki/VTK/Tutorials/SmartPointers

Thanks,

David



More information about the vtkusers mailing list