vtkHyperStreamline
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
This class seg faults if pointer sPtr is accessed after a call to InsertNextHyperPoint if the array of points gets resized. Below follows the snippet where crashing typically occur.
excerpt from line 531:
sNext = this->Streamers[ptId].InsertNextHyperPoint();
if ( cell->EvaluatePosition(xNext, closestPoint, sNext->SubId,
sNext->P, dist2, w) )
{ //integration still in cell
for (i=0; i<3; i++)
{
sNext->X[i] = closestPoint[i];
}
sNext->CellId = sPtr->CellId; (crashes if array is resized - sPtr is not valid anymore)
sNext->SubId = sPtr->SubId;
}
else ...
A temporary fix can be done by restoring the sPtr pointer after insertion of new point:
// get a hold of the number of points index = this->Streamers[ptId].GetNumberOfPoints();
// insert next point
sNext = this->Streamers[ptId].InsertNextHyperPoint();
// make sure sPtr is still valid after possible Resizing
sPtr = this->Streamers[ptId].GetHyperPoint(index-1);