From 2a3c37f424a4d1b9f4c5a2960a1cbe3517eac007 Mon Sep 17 00:00:00 2001 From: Andy Toulouse Date: Thu, 25 Jan 2018 20:09:09 -0800 Subject: [PATCH] Give IInspector a virtual destructor for correct InspectorImpl destruction Reviewed By: bnham Differential Revision: D6815637 fbshipit-source-id: bfd3bd4a664ec51d5364df512bfc9bc366f516c1 --- ReactCommon/jsinspector/InspectorInterfaces.cpp | 7 ++++--- ReactCommon/jsinspector/InspectorInterfaces.h | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ReactCommon/jsinspector/InspectorInterfaces.cpp b/ReactCommon/jsinspector/InspectorInterfaces.cpp index 2129287593ba9f..f1fa2ed57a684e 100644 --- a/ReactCommon/jsinspector/InspectorInterfaces.cpp +++ b/ReactCommon/jsinspector/InspectorInterfaces.cpp @@ -18,9 +18,10 @@ namespace react { // pure destructors in C++ are odd. You would think they don't want an // implementation, but in fact the linker requires one. Define them to be // empty so that people don't count on them for any particular behaviour. -IDestructible::~IDestructible() { } -ILocalConnection::~ILocalConnection() { } -IRemoteConnection::~IRemoteConnection() { } +IDestructible::~IDestructible() {} +ILocalConnection::~ILocalConnection() {} +IRemoteConnection::~IRemoteConnection() {} +IInspector::~IInspector() {} namespace { diff --git a/ReactCommon/jsinspector/InspectorInterfaces.h b/ReactCommon/jsinspector/InspectorInterfaces.h index d137f5a580e46c..0222501f3a043c 100644 --- a/ReactCommon/jsinspector/InspectorInterfaces.h +++ b/ReactCommon/jsinspector/InspectorInterfaces.h @@ -44,11 +44,13 @@ class ILocalConnection : public IDestructible { }; /// IInspector tracks debuggable JavaScript targets (pages). -class IInspector { +class IInspector : public IDestructible { public: using ConnectFunc = std::function( std::unique_ptr)>; + virtual ~IInspector() = 0; + /// addPage is called by the VM to add a page to the list of debuggable pages. virtual int addPage(const std::string& title, ConnectFunc connectFunc) = 0;