Browse Source

Fix virtual destructors

Classes with virtual functions and non-virtual destructors are probably
wrong. Some destructors were added, one class had its virtual functions
changed to ordinary, since it did not need them.

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac408@3672 e5f2f494-b856-4b98-b285-d166d9295462
Michal Vaner 14 years ago
parent
commit
6eb9009f87
3 changed files with 13 additions and 6 deletions
  1. 3 0
      src/lib/nsas/asiolink.h
  2. 8 6
      src/lib/nsas/hash_table.h
  3. 2 0
      src/lib/nsas/lru_list.h

+ 3 - 0
src/lib/nsas/asiolink.h

@@ -35,6 +35,9 @@ public:
     IOAddress(const std::string& address_str) : address_(address_str)
     {}
 
+    /// \param Just a virtual destructor
+    virtual ~ IOAddress() { }
+
     /// \return Textual representation of the address
     std::string toText() const
     {return address_;}

+ 8 - 6
src/lib/nsas/hash_table.h

@@ -100,6 +100,8 @@ public:
     ///
     /// \return bool true of the name of the object is equal to the name given.
     virtual bool operator()(T* object, const HashKey& key) const = 0;
+    /// \brief Virtual destructor
+    virtual ~ HashTableCompare() { }
 };
 
 
@@ -152,7 +154,7 @@ public:
     /// calculated and used to index the table.
     ///
     /// \return Shared pointer to the object or NULL if it is not there.
-    virtual boost::shared_ptr<T> get(const HashKey& key) {
+    boost::shared_ptr<T> get(const HashKey& key) {
         uint32_t index = hash_(key);
         sharable_lock lock(table_[index].mutex_);
         return getInternal(key, index);
@@ -168,7 +170,7 @@ public:
     /// calculated and used to index the table.
     ///
     /// \return true if the object was deleted, false if it was not found.
-    virtual bool remove(const HashKey& key);
+    bool remove(const HashKey& key);
 
     /// \brief Add Entry
     ///
@@ -184,7 +186,7 @@ public:
     /// same name already exists, the existing object is replaced.  If false,
     // the addition fails and a status is returned.
     /// \return true if the object was successfully added, false otherwise.
-    virtual bool add(boost::shared_ptr<T>& object, const HashKey& key,
+    bool add(boost::shared_ptr<T>& object, const HashKey& key,
         bool replace = false)
     {
         uint32_t index = hash_(key);
@@ -234,15 +236,15 @@ public:
     /// \brief Returns Size of Hash Table
     ///
     /// \return Size of hash table
-    virtual uint32_t tableSize() const {
+    uint32_t tableSize() const {
         return table_.size();
     }
 
 protected:
     // Internal parts, expect to be already locked
-    virtual boost::shared_ptr<T> getInternal(const HashKey& key,
+    boost::shared_ptr<T> getInternal(const HashKey& key,
         uint32_t index);
-    virtual bool addInternal(boost::shared_ptr<T>& object, const HashKey& key,
+    bool addInternal(boost::shared_ptr<T>& object, const HashKey& key,
         uint32_t index, bool replace = false);
 
 private:

+ 2 - 0
src/lib/nsas/lru_list.h

@@ -66,6 +66,8 @@ public:
         ///
         /// \param drop Object being dropped.
         virtual void operator()(T* drop) const = 0;
+        /// \brief Virtual destructor
+        virtual ~ Dropped() { }
     };
 
     /// \brief Constructor