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

Add virtual destructors to Checker and Notifier base classes #33

Merged
merged 2 commits into from
Apr 5, 2024

Conversation

wandernauta
Copy link
Contributor

Checkers are kept in a vector<unique_ptr<Checker>>. If they were ever removed from that vector, they would be deleted through a base pointer. Since the different Checker subclasses have different fields and sizes, those would then not be correctly cleaned up.

The Notifier base class is then changed for consistency.

Checkers are deleted through a smart pointer to base (the std::unique_ptr in g_checkers) so need a virtual destructor.
This is not strictly necessary as Notifiers are managed through std::shared_ptr only, but do so anyway for consistency with Checker.
@berthubert berthubert merged commit 5891f26 into berthubert:main Apr 5, 2024
1 check passed
@berthubert
Copy link
Owner

good catch, thanks!

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.

None yet

2 participants