build+src: mark destructor virtual in classes with virtual functions
And to prevent similar mistakes in the future, add -Wnon-virtual-dtor
to the default build flags.
Change-Id: I28e2361341abab29fca134309288cd259736d67a
diff --git a/src/security/v2/trust-anchor-group.hpp b/src/security/v2/trust-anchor-group.hpp
index 356a2a3..8e41ebb 100644
--- a/src/security/v2/trust-anchor-group.hpp
+++ b/src/security/v2/trust-anchor-group.hpp
@@ -25,8 +25,8 @@
#include "../../data.hpp"
#include "certificate.hpp"
-#include <set>
#include <boost/filesystem/path.hpp>
+#include <set>
namespace ndn {
namespace security {
@@ -35,6 +35,9 @@
class CertContainerInterface
{
public:
+ virtual
+ ~CertContainerInterface() = default;
+
virtual void
add(Certificate&& cert) = 0;
@@ -51,9 +54,11 @@
/**
* @brief Create an anchor group
*/
- explicit
TrustAnchorGroup(CertContainerInterface& certContainer, const std::string& id);
+ virtual
+ ~TrustAnchorGroup();
+
/**
* @return group id
*/
@@ -145,7 +150,8 @@
* @throw std::invalid_argument @p refreshPeriod is negative
*/
DynamicTrustAnchorGroup(CertContainerInterface& certContainer, const std::string& id,
- const boost::filesystem::path& path, time::nanoseconds refreshPeriod, bool isDir = false);
+ const boost::filesystem::path& path, time::nanoseconds refreshPeriod,
+ bool isDir = false);
void
refresh() override;