Skip to content

Fix in PCLVisualizer::convertPointCloudToVTKPolyData: do not re-use v…#6440

Open
mvieth wants to merge 2 commits into
PointCloudLibrary:masterfrom
mvieth:visualizer_fix_getverts
Open

Fix in PCLVisualizer::convertPointCloudToVTKPolyData: do not re-use v…#6440
mvieth wants to merge 2 commits into
PointCloudLibrary:masterfrom
mvieth:visualizer_fix_getverts

Conversation

@mvieth
Copy link
Copy Markdown
Member

@mvieth mvieth commented May 9, 2026

…ertices

vtkPolyData::SetVerts checks if the given vertices are different from the ones that vtkPolyData already has, and only then it updates some internal data structures (see also https://github.com/Kitware/VTK/blob/9ca1503e1c3c65c571ebd256d2aeabf777944ad6/Common/DataModel/vtkPolyData.cxx#L427 ). This means, if we call GetVerts(), and vtkPolyData returns some existing vertices, which we then modify and pass to SetVerts(), there is no guarantee that the internal data structures of vtkPolyData are all correctly updated. The fix is that we do not call GetVerts(), instead we always recreate the vertices array from scratch.

Fixes #6434

…ertices

vtkPolyData::SetVerts checks if the given vertices are different from the ones that vtkPolyData already has, and only then it updates some internal data structures (see also https://github.com/Kitware/VTK/blob/9ca1503e1c3c65c571ebd256d2aeabf777944ad6/Common/DataModel/vtkPolyData.cxx#L427 ). This means, if we call GetVerts(), and vtkPolyData returns some existing vertices, which we then modify and pass to SetVerts(), there is no guarantee that the internal data structures of vtkPolyData are all correctly updated. The fix is that we do not call GetVerts(), instead we always recreate the vertices array from scratch.
If we remove it, a visualization test segfaults for VTK 7. Also, as far as I can say, the bug that we try to fix by removing GetVerts(), does not even occurr in VTK 7.
So: VTK 9 and newer: remove GetVerts() to fix the bug. VTK 8 and older: leave everything as it is.
@mvieth mvieth marked this pull request as ready for review May 10, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: fix Meta-information for changelog generation module: visualization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[visualizer] Crash in vtkCellPicker when constantly calling updatePointCloud in PCLVisualizer

1 participant