Skip to content

Commit

Permalink
Revert "AK: Remove virtual destructors from non-virtual classes"
Browse files Browse the repository at this point in the history
This reverts commit 4378d36.
  • Loading branch information
IdanHo authored and linusg committed Apr 23, 2021
1 parent bf9c04a commit f90c224
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion AK/IntrusiveRedBlackTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ template<Integral K, typename V, IntrusiveRedBlackTreeNode<K> V::*member>
class IntrusiveRedBlackTree : public BaseRedBlackTree<K> {
public:
IntrusiveRedBlackTree() = default;
~IntrusiveRedBlackTree()
virtual ~IntrusiveRedBlackTree() override
{
clear();
}
Expand Down
4 changes: 3 additions & 1 deletion AK/RedBlackTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ class BaseRedBlackTree {
: key(key)
{
}
virtual ~Node() {};
};

protected:
BaseRedBlackTree() = default; // These are protected to ensure no one instantiates the leaky base red black tree directly
virtual ~BaseRedBlackTree() {};

void rotate_left(Node* subtree_root)
{
Expand Down Expand Up @@ -416,7 +418,7 @@ template<Integral K, typename V>
class RedBlackTree : public BaseRedBlackTree<K> {
public:
RedBlackTree() = default;
~RedBlackTree()
virtual ~RedBlackTree() override
{
clear();
}
Expand Down

0 comments on commit f90c224

Please sign in to comment.