src: lock the isolate properly in IsolateData destructor · nodejs/node@619e52c · GitHub
Skip to content

Commit 619e52c

Browse files
joyeecheungRafaelGSS
authored andcommitted
src: lock the isolate properly in IsolateData destructor
Otherwise it may fail the DCHECK that uses the locked thread as a fast path to get the current thread. PR-URL: #57031 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent 44b19ec commit 619e52c

3 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/env.cc

Lines changed: 1 addition & 0 deletions

test/cctest/test_environment.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ TEST_F(EnvironmentTest, InspectorMultipleEmbeddedEnvironments) {
438438
// This test sets a global variable in the child Environment, and reads it
439439
// back both through the inspector and inside the child Environment, and
440440
// makes sure that those correspond to the value that was originally set.
441+
v8::Locker locker(isolate_);
441442
const v8::HandleScope handle_scope(isolate_);
442443
const Argv argv;
443444
Env env {handle_scope, argv};
@@ -507,6 +508,7 @@ TEST_F(EnvironmentTest, InspectorMultipleEmbeddedEnvironments) {
507508
CHECK_NOT_NULL(isolate);
508509

509510
{
511+
v8::Locker locker(isolate);
510512
v8::Isolate::Scope isolate_scope(isolate);
511513
v8::HandleScope handle_scope(isolate);
512514

@@ -630,6 +632,7 @@ TEST_F(NodeZeroIsolateTestFixture, CtrlCWithOnlySafeTerminationTest) {
630632

631633
// Try creating Context + IsolateData + Environment.
632634
{
635+
v8::Locker locker(isolate);
633636
v8::Isolate::Scope isolate_scope(isolate);
634637
v8::HandleScope handle_scope(isolate);
635638

test/cctest/test_platform.cc

Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)