[vtk-developers] More (fundamental) nastiness in vtkImageMultipleInputFilter
Charl P. Botha
c.p.botha at ewi.tudelft.nl
Mon Mar 15 18:18:54 EST 2004
When vtkImageMultipleInputFilter calls ThreadedExecute, it's called with
"this->GetInputs()" as one of its parameters, the idea being that the
child class will know how many inputs to use.
The fundamental problem with this is that the Inputs array is only valid
for an index < GetNumberOfInputs(), but that the child's implementation
of ThreadedExecute has no access to this call. NumberOfInputs starts at
0 and grows as new inputs are added.
To see this go wrong, instantiate for example a vtkImageMathematics, set
its first input and then call its Update() method. Watch your
This is because this class's ThreadedExecute() checks for
this->Inputs, which is past the end of the Inputs array! It finds
_some_ value and subsequently tries to dereference it. BOOM.
My suggestion for a fix (workaround?) is that authors of
vtkImageMultipleInputFilter child classes call SetNthInput(NULL) for as
many inputs as they maximally are going to check for in ThreadedExecute.
Alternatively (and this is far more invasive), NumberOfInputs should
be passed to the ThreadedExecute method.
Any other ideas?
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/
More information about the vtk-developers