[vtk-developers] segfault when DeepCopy()ing PolyData with Links built

Charl P. Botha c.p.botha at its.tudelft.nl
Mon Apr 14 11:19:07 EDT 2003


On Mon, 2003-04-14 at 15:50, Charl P. Botha wrote:
> When I DeepCopy() a vtkPolyData() that has its Links built (i.e. after a
> BuildLinks() call) the application segfaults.  This is with VTK CVS on
> Debian Linux 3.0.

Okay, I think I've found the problem.  It's due to changes that happened
between version 1.145 and 1.146:

revision 1.146
date: 2002/02/18 19:22:23;  author: turner;  state: Exp;  lines: +5 -11
ERR: DeepCopy did not handle the Cell and Link data correctly.  These
should be rebuilt instead of copied if they are required.

I've attached the diff for this breakage: vtkPolyData-breakage.diff. 
Why this breaks: you can't call BuildLinks if you haven't copied the
points yet!  That only happens when the PARENT DeepCopy is called.  At
the moment, BuildLinks is invoked BEFORE the parent DeepCopy() is
called.  This is causing the segfault.

Very humbly I *have* to wonder why, if the change was supposed to fix
DeepCopy()ing of Cell and Link data, the DeepCopy()ing of Cell and Link
data wasn't tested after the change.

My proposed fix is to call the parent DeepCopy() at the beginning of the
method.  I've attached a diff: vtkPolyData-DeepCopy-FIX.diff.  I've
tested this and the segfault is gone.  If there are no objections, I'd
like to commit this.

Thanks,
Charl

-- 
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkPolyData-breakage.diff
Type: text/x-patch
Size: 1552 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20030414/9555ca8f/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkPolyData-DeepCopy-FIX.diff
Type: text/x-patch
Size: 783 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20030414/9555ca8f/attachment-0003.bin>


More information about the vtk-developers mailing list