[vtkusers] Null vtkFloatArray pointer in vtkPoints::vtkPoints()

Selvig, Andy Andy.Selvig at goodrich.com
Wed Oct 31 15:50:17 EDT 2007


VTK Users-

I'm having an issue creating vtkPoints. Here's my setup:

Windows XP, MSVC2005
VTK 5.0.3 dll debug

Basically, vtkFloatArray::New() is creating a null pointer in
vtkPoints::vtkPoints() :

// from vtkpoints.cxx, line 56
vtkPoints::vtkPoints(int dataType)
{
  this->Data = vtkFloatArray::New(); // value returned here is
0x00000000
  this->Data->Register(this); // access violation raised here
  this->Data->Delete();
  this->SetDataType(dataType);
...

Understandably, an access violation is caused when a method is called on
Data. I don't understand what would cause a constructor to return a null
pointer. This particular constructor is called several dozen times
before this error occurs. Here's the last chunk of my code in the stack:


	// create the points
	points = vtkPoints::New(); // error here
	points->SetNumberOfPoints(nPoints);
	points->SetData(gridData);
	gridData->Delete();

	// create the polydata
	gridPolyData = vtkPolyData::New();
	gridPolyData->SetPoints(points);
	gridPolyData->SetLines(cellArray);
	points->Delete();
	cellArray->Delete();

	// create mapper and actor
	m_gridMappers[i]->SetInput(gridPolyData);
	m_gridActors[i]->SetMapper(m_gridMappers[i]);
	gridPolyData->Delete();


The error happens on the first line. This whole chunk is inside a loop
that executes several times before the error. gridData and cellArray are
a vtkFloatArray and vtkCellArray that keep being re-instantiated each
time through the loop. m_gridActors and m_gridMappers are arrays of
vtkPolyDataMappers and vtkActors.

Does anyone know why something like this would happen? Thanks in advance
for your help.

Regards,

Andy Selvig





More information about the vtkusers mailing list