[vtk-developers] VTK SetPoints Error

Ragu Vijaykumar ragu at myosight.org
Sun Dec 19 06:12:19 EST 2010


Hi all,

This is my first time posting to this list, so I hope someone out there can help me. I have the following code that needs to create a model that I will specify. I am using VTK 5.6.1 under OSX 10.6.5 with Cocoa build and RelWithDebInfo, linked with Qt 4.7, and 
VTK_REQUIRED_OBJCXX_FLAGS:STRING="" to get it to work with Qt.

The issue lies with the SetPoints method, which seems to automatically delete the parameter 'Points'. I stepped through the debugger, and it shows that the method makes points reference count 0 from 1, while the fielddata and cells lines all work as expected. My program crashes on 'points->Delete' everytime, and I'm not sure why?


	vtkPolyData* model = vtkPolyData::New();
	cout << model->GetPoints() << endl;

	vtkPoints* points = vtkPoints::New();
	model->SetPoints(points);
	points->Delete();
	
	vtkFieldData* fieldData = vtkFieldData::New();
	model->SetFieldData(fieldData);
	fieldData->Delete();
	
	vtkCellArray* cells = vtkCellArray::New();
	model->SetVerts(cells);
	cells->Delete();	



Ragu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20101219/618855af/attachment.html>


More information about the vtk-developers mailing list