[vtkusers] vtkAppendFilter, Delete & segfault

Burlen burlen at apollo.sr.unh.edu
Thu Dec 28 12:08:47 EST 2006


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



More information about the vtkusers mailing list