Skip to content
Browse files

src: add public virtual destructor for KVStore

As KVStore has derived classes, it is essential to
declare a public virtual destructor in the base
KVStore class. Otherwise, deleting derived class
instances using base class pointers would
potentially cause undefined behaviour.

Additionally, since we are implementing a non-default
destructor, the special member functions have also
been implemented in order to abide by the rule of five.

PR-URL: #28737
Reviewed-By: Anna Henningsen <>
Reviewed-By: Rich Trott <>
  • Loading branch information...
GauthamBanasandra authored and targos committed Jul 17, 2019
1 parent 7b0b06d commit 74243da70792f49cabd5e2b8bff5b915b4a3e759
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/env.h
@@ -582,6 +582,13 @@ class AsyncRequest : public MemoryRetainer {

class KVStore {
KVStore() = default;
virtual ~KVStore() = default;
KVStore(const KVStore&) = delete;
KVStore& operator=(const KVStore&) = delete;
KVStore(KVStore&&) = delete;
KVStore& operator=(KVStore&&) = delete;

virtual v8::Local<v8::String> Get(v8::Isolate* isolate,
v8::Local<v8::String> key) const = 0;
virtual void Set(v8::Isolate* isolate,

0 comments on commit 74243da

Please sign in to comment.
You can’t perform that action at this time.