[vtk-developers] Re: [vtkusers] Unconnected filter(s) causing seg faults

Charl P. Botha c.p.botha at ewi.tudelft.nl
Thu Oct 16 17:19:43 EDT 2003


Berk Geveci wrote:
> Currently, yes. I think we should change the check in vtkSource. Instead
> of comparing NumberOfInputs to NumberOfRequiredInputs, it probably
> should check that the first NumberOfRequiredInputs inputs are non-null.
> What do you think?

That sounds like the Right Thing To Do(tm).

> nb. I still think that calling SetNumberOfInputs(1) in the constructor
> is wrong.

Well, I had another look, and it seems SetNumberOfInputs() also 
allocates the input array, so it can be construed as correct for a 
filter to call SetNumberOfInputs(1) in its constructor.  See 
vtkProcessObject::SetNumberOfInputs().

To reiterate: I think your plan of actually checking the number of 
non-null inputs against the NumberOfRequiredInputs in vtkSource.cxx is 
good.  I grepped through all the C++ source, and NumberOfRequiredInputs 
isn't being checked anywhere else than in vtkSource.cxx.

This should solve a whole slew of the null input problems!

Thanks,
Charl

-- 
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/




More information about the vtkusers mailing list