[vtkusers] Segmentation fault when Delete() is called on an output from a filter
Anthony
slam_ono at yahoo.com
Wed Jun 24 05:35:46 EDT 2009
Hi all,
In this part of code I tried to create a new vtkImageData , pass it through vtkImageFlip , get the output and then tried to free the memory. Don't know why I get Segmentation fault , what could I be missing here? really appreciate any suggestion .
vtkImageData *id =vtkImageData::New();
id->SetDimensions(10,25,100);
id->SetScalarTypeToUnsignedShort();
id->SetNumberOfScalarComponents(1);
id->AllocateScalars();
unsigned short *ptr= (unsigned short *) id->GetScalarPointer();
for(int i=0; i<10*25*100;i++)
{
*ptr++=i;
}
vtkImageFlip *flipX=vtkImageFlip::New();
flipX->SetInput(id);
flipX->SetFilteredAxis(0);
flipX->Update();
vtkImageData *id2=vtkImageData::SafeDownCast(flipX->GetOutput());
id->Delete();
flipX->Delete();
id2->Delete(); //probably because of this?
Cheers,
Anthony
Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com.
http://mail.promotions.yahoo.com/newdomains/aa/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090624/e4d402ca/attachment.htm>
More information about the vtkusers
mailing list