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

Lorensen, William E (Research) lorensen at crd.ge.com
Mon Apr 14 17:05:46 EDT 2003


Looks like the proper fix.

-----Original Message-----
From: Charl P. Botha [mailto:c.p.botha at its.tudelft.nl]
Sent: Monday, April 14, 2003 11:19 AM
To: VTK Developers
Subject: Re: [vtk-developers] segfault when DeepCopy()ing PolyData with
Links built


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/



More information about the vtk-developers mailing list