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

Berk Geveci berk.geveci at kitware.com
Thu Oct 16 13:38:57 EDT 2003


I have been looking at this (VTK bug #280). In theory, the superclass
(vtkSource) should check if the necessary inputs are set and if not,
should not call Execute(). This is why there is an ivar called
NumberOfRequiredInputs. The following from vtkSource.cxx (in 
UpdateData() ) performs the appropriate check:

  if (this->NumberOfInputs < this->NumberOfRequiredInputs)
    {
    vtkErrorMacro(<< "At least " << this->NumberOfRequiredInputs << "
inputs are required but only " << this->NumberOfInputs << " are
specified");
    }
  else
  ...

Each filter (or superclass) should 1) initialize NumberOfRequiredInputs
properly, 2) should do the right check if they overwrite UpdateData().
Here is the problem:

vtkPolyDataToPolyDataFilter::vtkPolyDataToPolyDataFilter() 
{
  this->vtkProcessObject::SetNumberOfInputs(1);
  this->NumberOfRequiredInputs = 1;
}

Setting the number of inputs to 1 in the constructor is wrong and I have
no idea why it was done. I will remove the SetNumberOfInputs from
the constructor. If someone has time to write a test (or modify
TestEmptyInput) to see if any filters crash with no input, I can
help to fix them.

-Berk

On Thu, 2003-10-16 at 10:34, N Smethurst wrote:
> I've filed a bug report on this problem, volunteering to do the work 
> required. Could a VTK developer take a look at it please?
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers





More information about the vtk-developers mailing list