crashes in vtkImageSliceCollection
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Certain combinations of layer numbers/insertion order lead to inconsistencies in internal data of vtkImageSliceCollection / vtkCollection, which leads to crashes upon further usage of the collection. I have attached code that demonstrates the issue.
The problem is, that the Bottom member of vtkCollection does not get updated correctly in all cases in vtkImageSliceCollection::AddItem(...). The following patch resolves the problem.
diff --git a/Rendering/Image/vtkImageSliceCollection.cxx b/Rendering/Image/vtkImageSliceCollection.cx index e33f93c..6018cbb 100644 --- a/Rendering/Image/vtkImageSliceCollection.cxx +++ b/Rendering/Image/vtkImageSliceCollection.cxx @@ -69,6 +69,7 @@ void vtkImageSliceCollection::AddItem(vtkImageSlice *a) elem->Next = indexElem->Next; indexElem->Item = a; indexElem->Next = elem;
-
if(this->Bottom == indexElem) this->Bottom = elem; this->NumberOfItems++; a->Register(this); return;