PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
10k stars 4.62k forks source link

PCLVisualizer::close() crash, and interactor_->SetDone(true) works #5556

Open huanglilong opened 1 year ago

huanglilong commented 1 year ago

https://github.com/PointCloudLibrary/pcl/blob/f17f6ddb655b1545dd00686753828ebbb0aa3c4a/visualization/src/pcl_visualizer.cpp#L4329

i'm writing same feature with PCLVisualizer with delay close, just like opencv waitKey() function, and i find when call pcl::visualization::PCLVisualizer::close () will crash ininteractor_->TerminateApp (); and i also tried interactor_->ExitCallback (); and crash too. butinteractor_->SetDone(true);works.

example code: crash in viewer_ptr_->close(); image

crash info: [1] 209646 segmentation fault (core dumped) ./build/test_lidar_extract_plane_main --pcd_dir --debug=true

debug info: interactor_ type: 26vtkXRenderWindowInteractor

huanglilong commented 1 year ago

VTK vtkXRenderWindowInteractor::TerminateApp() issue: https://gitlab.kitware.com/vtk/vtk/-/issues/18749

huanglilong commented 1 year ago

fixed in https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9686

huanglilong commented 1 year ago

@mvieth need your help in https://gitlab.kitware.com/vtk/vtk/-/issues/18749

crash version: VTK latest master, PCL latest master

mvieth commented 1 year ago

@huanglilong I am not sure what you are asking me to do? Seems to me like it is the VTK maintainer's turn to investigate the problem, since it is likely on their side. BTW I found a VTK example (https://kitware.github.io/vtk-examples/site/Cxx/Visualization/CloseWindow/) which (like PCLVisualizer::close()) calls vtkRenderWindow::Finalize() then vtkRenderWindowInteractor::TerminateApp(). This example seems to have the same problem as you have.

huanglilong commented 1 year ago

to make sure https://github.com/PointCloudLibrary/pcl/blob/master/visualization/src/vtk/vtkRenderWindowInteractorFix.cpp is using the VTK version, and i has checked(so nothing need to do), with VTK9.2.2 PCL using the origin VTK version. so this is issue from VTK. @mvieth