[vtk-developers] Re: [vtkusers] Unconnected filter(s) causing seg faults
N Smethurst
nick.smethurst at free.fr
Fri Oct 17 07:26:18 EDT 2003
Hi again guys
So if I understood correctly, null checks should be made before Execute() is
called, and so there should be no need for any of the checks that already
exist in the Execute() methods of filters?
Another point of interest: will the proposed solution also deal with setting
the input of a filter to null? i.e. a filter with a previously connected
input has
filter_object->SetInput(0);
done to it in order to disconnect the output of the previous object.
Nic
Le Jeudi 16 Octobre 2003 23:19, Charl P. Botha a écrit :
> 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
>
More information about the vtkusers
mailing list