Skip to content

Commit e2fb368

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.
1 parent d5737a8 commit e2fb368

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/env.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,13 @@ class AsyncRequest : public MemoryRetainer {
602602

603603
class KVStore {
604604
public:
605+
KVStore() = default;
606+
virtual ~KVStore() = default;
607+
KVStore(const KVStore&) = delete;
608+
KVStore& operator=(const KVStore&) = delete;
609+
KVStore(KVStore&&) = delete;
610+
KVStore& operator=(KVStore&&) = delete;
611+
605612
virtual v8::Local<v8::String> Get(v8::Isolate* isolate,
606613
v8::Local<v8::String> key) const = 0;
607614
virtual void Set(v8::Isolate* isolate,

0 commit comments

Comments
 (0)