[vtkusers] Cone6.cxx vtkBoxWidget memory leak

Luca Picello luca.picello at libero.it
Sun May 9 19:20:44 EDT 2004


Thank you Drew,
you are right. Now the cone6 example runs without any problem.

Another cleanup I've found and maybe resolved for the community is in 
\Common\vtkAbstractMapper.cxx

void vtkAbstractMapper::SetClippingPlanes(vtkPlanes *planes)
{
  vtkPlane *plane;
  if (!planes)
    {
    return;
    }

  int numPlanes = planes->GetNumberOfPlanes();

  this->RemoveAllClippingPlanes();
  for (int i=0; i<numPlanes && i<6; i++)
    {
    plane = planes->GetPlane(i);
    this->AddClippingPlane(plane);
    plane->Delete();    // <-- Added
    }
}


Drew Dolgert wrote:

>Hi,
>
>The leak is in the callback:
>
>  virtual void Execute(vtkObject *caller, unsigned long, void*)
>    {
>      vtkTransform *t = vtkTransform::New();
>      vtkBoxWidget *widget = reinterpret_cast<vtkBoxWidget*>(caller);
>      widget->GetTransform(t);
>      widget->GetProp3D()->SetUserTransform(t);
>      // Add this:
>      t->Delete();
>    }
>
>You need to release the reference to the transform at the end.
>
>- Drew
>
>-----Original Message-----
>From: vtkusers-admin at vtk.org [mailto:vtkusers-admin at vtk.org] On Behalf
>Of Luca Picello
>Sent: Sunday, May 09, 2004 12:36 PM
>To: VTK Users
>Subject: [vtkusers] Cone6.cxx vtkBoxWidget memory leak
>
>
>Hallo everybody,
>I compiled VTK with Borland C++ builder 6 with Codeguard memory leak 
>manager.
>Then I compiled Cone6.cxx (no VCL, without using vtkBorlandRenderWindow 
>component ).
>It starts and runs successfully and it exists fine if I dont throw any 
>mouse event on the cone area.
>But start the application and just move a little ball around the cone 
>and exit: codeguard returns error.
>Take a look to the screenshot.
>
>Can somebody (author?) help me to solve?
>Picello Luca
>
>
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>.
>
>  
>




More information about the vtkusers mailing list