[vtkusers] SmartPointer gets released too early...

Lodron, Gerald Gerald.Lodron at joanneum.at
Wed Jul 4 00:55:02 EDT 2012


Hi

I made a program with PCL 1.5.1 and VTK 5.10 in 64bit which works on my machine. When I use SAME CODE WITH SAME CMAKE AND LIBRARIES on a second machine I get the strange behavior that after the SetInput( myVTKPolygonData ) of vtkCutter the GetInput() returns a NULL pointer. This behavior is only at the other machine of a college (not on mine) and it seems that it is caused by the call pcl::io::mesh2vtk( myPCLMesh, myVTKPolygonData). If I comment that line the GetInput() method of vtkCutter suddenly return a nonempty smartpointer of vtkPolyData.

Any hints what could cause such a strange behaviour?

Here my code:

Pcl::PolygonMesh oPCLMesh;
//initialize pcl mesh...

vtkSmartPointer<vtkCutter> oCutter = vtkSmartPointer<vtkCutter>::New();
vtkSmartPointer<vtkPolyData> oVTKPolyData = vtkSmartPointer<vtkPolyData>::New();

// oVTKPolyData has zero points but is NOT NULL
oCutter->SetInput( oVTKPolyData );
oCutter->GetInput() // is not NULL, CORRECT

pcl::io::mesh2vtk( oPCLMesh, oWallPolyData );
oCutter->GetInput() // is NULL, WTF?
//try again
oCutter->SetInput( oVTKPolyData );
oCutter->GetInput() // is NULL, WTF?


Thanks,

DI Gerald Lodron

Machine Vision Applications

DIGITAL - Institute for Information and Communication Technologies

JOANNEUM RESEARCH Forschungsgesellschaft mbH
Steyrergasse 17, 8010 Graz, AUSTRIA

phone:   +43-316-876-1751       personal fax: +43-316-876-91751
mobile:   +43-699-1876-1751      general fax: +43-316-876-1720
web: http://www.joanneum.at/digital
e-mail: gerald.lodron at joanneum.at<mailto:gerald.lodron at joanneum.at>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120704/2daa3b10/attachment.htm>


More information about the vtkusers mailing list