The vtkLinearExtrusionFilter is not thread safe
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Multiple instances of vtkLinearExtrusionFilter cannot run in multiple threads, because this filter uses static variables to store its internal method return values. The bad code, which dates back to 1995, is as follows:
double *vtkLinearExtrusionFilter::ViaNormal(double x[3], vtkIdType id, vtkDataArray *n) { static double xNew[3], normal[3]; int i;
n->GetTuple(id, normal); for (i=0; i<3; i++) { xNew[i] = x[i] + this->ScaleFactor*normal[i]; }
return xNew; }
double *vtkLinearExtrusionFilter::ViaVector(double x[3], vtkIdType vtkNotUsed(id), vtkDataArray *vtkNotUsed(n)) { static double xNew[3]; int i;
for (i=0; i<3; i++) { xNew[i] = x[i] + this->ScaleFactor*this->Vector[i]; }
return xNew; }
double *vtkLinearExtrusionFilter::ViaPoint(double x[3], vtkIdType vtkNotUsed(id), vtkDataArray *vtkNotUsed(n)) { static double xNew[3]; int i;
for (i=0; i<3; i++) { xNew[i] = x[i] + this->ScaleFactor*(x[i] - this->ExtrusionPoint[i]); }
return xNew; }