Skip to content

Commit

Permalink
src: add lock to inspector MainThreadHandle dtor
Browse files Browse the repository at this point in the history
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: #26010
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
addaleax committed Feb 13, 2019
1 parent 60c5099 commit adaa2ae
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/inspector/main_thread_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit adaa2ae

Please sign in to comment.