Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use public virtual destructor in isobus::CANHardwarePlugin #534

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

bigdavedev
Copy link
Contributor

Describe your changes

In order to be able to use classes such as isobus::CANHardwarePlugin polymophically C++ requires a public virtual destructor in the base class, otherwise the behaviour of the delete expression via pointer-to-base is undefined.

This was picked up by my client's linter.

For reference, this check is enabled in Sonar but it seems to miss this file somehow.

Fixes # (issue)

No issue found in tracker.

How has this been tested?

Patch applied internally and linting no longer reportes this error.

In order to be able to use classes such as `isobus::CANHardwarePlugin`
polymophically C++ requires a `virtual` destructor in the base class.
This ensures that, when the pointer to base is destroyed, that it will
correctly call the derived destructors as well.
Copy link
Member

@GwnDaan GwnDaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thanks for your contribution

@GwnDaan GwnDaan merged commit ffd6bb9 into Open-Agriculture:main Jan 14, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants