[vtkusers] Deleting unknown object

Paul Edwards paul.m.edwards at gmail.com
Wed Oct 14 08:01:38 EDT 2009


You do need to call Delete on everything that you create with New.

>   vtkTree* MinimumSpanningTree = vtkTree::New();
>   MinimumSpanningTree = MinimumSpanningTreeFilter->GetOutput();

The problem you have here is you are setting the pointer value to the
output of the filter.  When you call Delete at the end, it is not the
memory that you obtained from calling New.  You should call one of the
copy functions, e.g.

    MinimumSpanningTree->ShallowCopy(MinimumSpanningTreeFilter->GetOutput());

Regards,
Paul



More information about the vtkusers mailing list