diff --git a/ReactCommon/hermes/inspector/Inspector.cpp b/ReactCommon/hermes/inspector/Inspector.cpp index 21b7bd2108de11..c17e43030428a0 100644 --- a/ReactCommon/hermes/inspector/Inspector.cpp +++ b/ReactCommon/hermes/inspector/Inspector.cpp @@ -132,7 +132,6 @@ Inspector::Inspector( } Inspector::~Inspector() { - // TODO: think about expected detach flow debugger_.setEventObserver(nullptr); } diff --git a/ReactCommon/hermes/inspector/Inspector.h b/ReactCommon/hermes/inspector/Inspector.h index 3e4612530ea869..a55f1c45b9cfb0 100644 --- a/ReactCommon/hermes/inspector/Inspector.h +++ b/ReactCommon/hermes/inspector/Inspector.h @@ -319,11 +319,6 @@ class Inspector : public facebook::hermes::debugger::EventObserver, facebook::hermes::debugger::Debugger &debugger_; InspectorObserver &observer_; - // All client methods (e.g. enable, setBreakpoint, resume, etc.) are executed - // on executor_ to prevent deadlocking on mutex_. See the implementation for - // more comments on the threading invariants used in this class. - std::unique_ptr executor_; - // All of the following member variables are guarded by mutex_. std::mutex mutex_; std::unique_ptr state_; @@ -360,6 +355,12 @@ class Inspector : public facebook::hermes::debugger::EventObserver, // Are we currently waiting for a debugger to attach, because we // requested 'pauseOnFirstStatement'? bool awaitingDebuggerOnStart_; + + // All client methods (e.g. enable, setBreakpoint, resume, etc.) are executed + // on executor_ to prevent deadlocking on mutex_. See the implementation for + // more comments on the threading invariants used in this class. + // NOTE: This needs to be declared LAST because it should be destroyed FIRST. + std::unique_ptr executor_; }; } // namespace inspector