From 894210ec12f07b8caa4e9f1bf5bdc58deaf079d1 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 2 Oct 2018 12:03:27 +0200 Subject: [PATCH] src: add virtual desctructor to Options class Currently the Options class has a virtual function but no virtual destructor which means that if delete is called on a Options pointer to a derived instance, the derived destructor will not get called. The following warning is currently being printed when compiling: warning: delete called on non-final 'node::PerIsolateOptions' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor] delete __ptr; This commit adds a virtual destructor. PR-URL: https://github.com/nodejs/node/pull/23215 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung Reviewed-By: Benjamin Gruenbaum Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- src/node_options.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node_options.h b/src/node_options.h index 32189dacfb080a..0e8af86218b641 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -24,6 +24,7 @@ struct HostPort { class Options { public: virtual void CheckOptions(std::vector* errors) {} + virtual ~Options() {} }; // These options are currently essentially per-Environment, but it can be nice