From dff7784ad3de0004faf5b5d2a3a30b0974ba9c5b Mon Sep 17 00:00:00 2001 From: Wander Nauta Date: Fri, 29 Mar 2024 12:37:18 +0100 Subject: [PATCH 1/2] Add a virtual destructor for Checker class Checkers are deleted through a smart pointer to base (the std::unique_ptr in g_checkers) so need a virtual destructor. --- simplomon.hh | 1 + 1 file changed, 1 insertion(+) diff --git a/simplomon.hh b/simplomon.hh index 878777e..c8ebc8a 100644 --- a/simplomon.hh +++ b/simplomon.hh @@ -65,6 +65,7 @@ public: // fmt::print("Adding notifier {}\n", n->getNotifierName()); } Checker(const Checker&) = delete; + virtual ~Checker() = default; void Perform() { d_reasons = this->perform(); From 239926bd4d08f301fa3061499c1bf6d2da0101ed Mon Sep 17 00:00:00 2001 From: Wander Nauta Date: Fri, 29 Mar 2024 12:38:02 +0100 Subject: [PATCH 2/2] Add a virtual destructor for Notifier class This is not strictly necessary as Notifiers are managed through std::shared_ptr only, but do so anyway for consistency with Checker. --- notifiers.hh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/notifiers.hh b/notifiers.hh index a2c749c..911d805 100644 --- a/notifiers.hh +++ b/notifiers.hh @@ -17,11 +17,7 @@ public: Notifier(bool) { } - - ~Notifier() - { - // fmt::print("A notifier was destroyed\n"); - } + virtual ~Notifier() = default; virtual void alert(const std::string& message) = 0; std::string getNotifierName() { return d_notifierName; } void bulkAlert(const std::string& textBody);