summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGauthamBanasandra <gautham.bangalore@gmail.com>2019-07-18 00:11:38 +0530
committerRich Trott <rtrott@gmail.com>2019-07-20 21:47:22 -0700
commit7a1f33c3946543adb6d8b6163b438d471b9c8b42 (patch)
treec0dd1af085d360c57d0217a4f1ebf8f8ecab6abf /src
parent49144ab64d3c5810f70585c2ccb0c90539fec116 (diff)
downloadandroid-node-v8-7a1f33c3946543adb6d8b6163b438d471b9c8b42.tar.gz
android-node-v8-7a1f33c3946543adb6d8b6163b438d471b9c8b42.tar.bz2
android-node-v8-7a1f33c3946543adb6d8b6163b438d471b9c8b42.zip
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: https://github.com/nodejs/node/pull/28737 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/env.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/env.h b/src/env.h
index 4e1629bb8a..a58b2a2b16 100644
--- a/src/env.h
+++ b/src/env.h
@@ -609,6 +609,13 @@ class AsyncRequest : public MemoryRetainer {
class KVStore {
public:
+ 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,