We’re using a
vtkMappedUnstructuredGrid for our input data. One of our filters takes our type as input, adds data and is supposed to output a regular
vtkUnstructuredGrid. We ran into a crash situation with this scenario because of the following:
At some point during pipeline execution the executive calls
vtkUnstructuredGrid::Initialize when it prepares the filter output. This deletes the connectivity and types arrays. However, filters may then call
vtkUnstructuredGrid::ShallowCopy in RequestData. This is a problem because there is special handling for
vtkUnstructuredGridBase and the connectivity and type arrays are not recreated before a call to
vtkUnstructuredGrid::InternalInsertNextCell, resulting in a crash.
For example this will crash:
// vtkUnstructuredGridBase subclass other than vtkUnstructuredGrid, e.g. vtkMappedUnstructuredGrid vtkSmartPointer<vtkMyMappedGrid> source = ...; vtkNew<vtkUnstructuredGrid> ug; ug->Initialize(); ug->ShallowCopy(source); // crashes
Are we using it wrong? Or am I correct that
vtkUnstructuredGrid::ShallowCopy requires a check an potential allocation there?
Happy to prepare a fix if this turns out to be a bug.