[vtkusers] vtkSmartPointer BUG

David Cole david.cole at kitware.com
Tue Oct 7 09:44:41 EDT 2008


I am not sure why that worked before...... It should have given you a memory
leak before. Maybe you didn't really have leak detection turned on before?
The correct New construct to use with vtkSmartPointer is:
  vtkSmartPointer<vtkSomeObject> ptr
= vtkSmartPointer<vtkSomeObject>::New();

HTH,
David


On Tue, Oct 7, 2008 at 9:39 AM, pjtr hahn <pjtr.hahn at googlemail.com> wrote:

> Hello,
>
> since my last CVS Update (today)  vtkSmartPointer isn't working like
> expected anymore.
>
> While code like
>
> function_scope{
>
> vtkSomeObject * ptr = vtkSomeObjekt::New();
>
> ...... more code ......
>
> ptr->Delete();
>
> }
>
> works I get memory leak error messages when changing the same code to
>
> function_scope{
>
> vtkSmartPointer< vtkSomeObject > ptr = vtkSomeObjekt::New();
>
> ...... more code ......
>
> } // end scope
>
> This worked before.
>
> I'm on Vista / Visual Studio Express 2008
>
> regards,
>
> Peter
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081007/bee944e1/attachment.htm>


More information about the vtkusers mailing list