[vtk-developers] VTK SetPoints Error

Ignaz Reicht i.reicht at dkfz-heidelberg.de
Sun Dec 19 14:48:33 EST 2010


Hv u tried using vtkSmartpointers instead of "Common"pointers? When  
using them u don't hv to Care about deleting Pointers.

Am 19.12.2010 um 12:12 schrieb Ragu Vijaykumar <ragu at myosight.org>:

> 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
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtk-developers/attachments/20101219/1b47ddc6/attachment.htm>


More information about the vtk-developers mailing list