From 82c4e170e5775ac0f3b4d14eba56a56f0c9126b4 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 8 Feb 2019 20:47:20 +0100 Subject: [PATCH] src: add lock to inspector `MainThreadHandle` dtor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- src/inspector/main_thread_interface.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/inspector/main_thread_interface.h b/src/inspector/main_thread_interface.h index 3e8eb13645b009..a7d9f8a3c939d8 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 { : main_thread_(main_thread) { } ~MainThreadHandle() { + Mutex::ScopedLock scoped_lock(block_lock_); CHECK_NULL(main_thread_); // main_thread_ should have called Reset } std::unique_ptr Connect(