Skip to content

Commit 74243da

Browse files
GauthamBanasandratargos
authored andcommitted
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 <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 7b0b06d commit 74243da

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
@@ -582,6 +582,13 @@ class AsyncRequest : public MemoryRetainer {
582582

583583
class KVStore {
584584
public:
585+
KVStore() = default;
586+
virtual ~KVStore() = default;
587+
KVStore(const KVStore&) = delete;
588+
KVStore& operator=(const KVStore&) = delete;
589+
KVStore(KVStore&&) = delete;
590+
KVStore& operator=(KVStore&&) = delete;
591+
585592
virtual v8::Local<v8::String> Get(v8::Isolate* isolate,
586593
v8::Local<v8::String> key) const = 0;
587594
virtual void Set(v8::Isolate* isolate,

0 commit comments

Comments
 (0)