Skip to content

[common/point_cloud] Please re-add virtual destructor to PointCloud for safe inheritance #4036

Closed
@dlazenby

Description

@dlazenby

My colleague and I recently attempted to update to PCL 1.10.1 [skipping 1.10.0] and noticed that in this commit from Nov. 2019 the "default destructors" were removed.

I see from this discussion on the pull request that certain virtual destructors were removed because PCL did not leverage them internally.
It is this one specifically that concerns me.

My concern: If the virtual destructor is removed, and I am inheriting from PointCloud (for reasons unspecified here, but available upon request) does this not open my code up to memory leaks if I pass my DerivedCloud into an existing PCL function which takes a PointCloud and then calls something that deletes the PointCloud downcast version of my DerivedCloud?

If it is not hurting anything to leave the virtual destructor for PointCloud (or in this case re-add the virtual destructor) can the virtual destructor be re-added so that I can continue to "safely inherit" from PointCloud?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions