[vtkusers] vtkAppendFilter, Delete & segfault

Randall Hand randall.hand at gmail.com
Thu Dec 28 12:19:09 EST 2006


I believe destroying the AppendFilter will resulting in deleting the Output
Dataset as well.  to get around this, you can try something like this:

merger->update();
vtkUnstructuredGrid *result = vtkUnstructuredGrid::New();
result->DeepCopy(merger->GetOutput());

merger->Delete();
return result;


On 12/28/06, Burlen < burlen at apollo.sr.unh.edu> wrote:
>
> Hi,
>
> I have a situation where I'm processing chunks of a data set and using the
>
> append filter to combine the result into another dataset. The chunks are
> passed into a subroutine where the processing and appending takes place.
> the
> append filter is new'd in the subtroutine, however if I delete the append
> filter then I get a segfault during any later opperations on the resulting
> dataset.
>
> it's some thing like this:
>
> vtkUnstructuredGrid *processData( vector<vtkUnstructuredGrid *> &chunks )
> {
>    vtkAppendFilter *merger = vtkAppendFilter::New();
>
>    for( each chunk )
>    {
>      //filter & process
>      // .
>      // .
>      // .
>
>      merger->AddInput( filterAndProc->GetOutput() );
>    }
>
>    merger->Update();
>
>    vtkUnstructuredGrid *result = merger->GetOutput();
>    result->Update();
>
>    merger->Delete(); // this ends up causing segfault later!!
>
>    return result;
> }
>
> I'm obviously creating a leak by not Delete'ing the append filter I new'd,
> so
> the question is why is this happening and what to do? I have a confession
> to
> make, I'm still using 4.4.
>
> --
>
> Burlen Loring
> Space Science Center
> Institute for the Study of Earth, Oceans, and Space
> University of New Hampshire
> 39 College Road, Durham, NH 03824
> Phone: 603-862-1140
> _______________________________________________
> 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
>



-- 
----------------------------------------
Randall Hand
Visualization Scientist
ERDC MSRC-ITL

-- 
----------------------------------------
Randall Hand
Visualization Scientist
ERDC MSRC-ITL
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061228/d4c4011a/attachment.htm>


More information about the vtkusers mailing list