diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-02-08 22:47:20 +0300 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2019-02-12 09:40:53 +0300 |
commit | 82c4e170e5775ac0f3b4d14eba56a56f0c9126b4 (patch) | |
tree | edb0429f642fe8a8a84ae919809463bb07f16c16 /src/inspector | |
parent | 93417ac99521f0164dfacbbc0f7d30806d1ec0e3 (diff) |
src: add lock to inspector `MainThreadHandle` dtor
Otherwise, the `CHECK` is reported to be a race condition
by automated tooling. It’s not easy to tell from looking at
the source code whether that is actually the case or not,
but adding this lock should be a safe way to resolve it.
PR-URL: https://github.com/nodejs/node/pull/26010
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/inspector')
-rw-r--r-- | src/inspector/main_thread_interface.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/inspector/main_thread_interface.h b/src/inspector/main_thread_interface.h index 3e8eb13645b..a7d9f8a3c93 100644 --- a/src/inspector/main_thread_interface.h +++ b/src/inspector/main_thread_interface.h @@ -45,6 +45,7 @@ class MainThreadHandle : public std::enable_shared_from_this<MainThreadHandle> { : main_thread_(main_thread) { } ~MainThreadHandle() { + Mutex::ScopedLock scoped_lock(block_lock_); CHECK_NULL(main_thread_); // main_thread_ should have called Reset } std::unique_ptr<InspectorSession> Connect( |