fix: destruction order of js env fields (#39521)
isolate_ depends on isolate_holder_ and so must be destroyed first.
This commit is contained in:
parent
b04ce6a5c8
commit
dd8df3b0c4
2 changed files with 9 additions and 4 deletions
|
@ -104,9 +104,10 @@ gin::IsolateHolder CreateIsolateHolder(v8::Isolate* isolate) {
|
||||||
|
|
||||||
JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop,
|
JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop,
|
||||||
bool setup_wasm_streaming)
|
bool setup_wasm_streaming)
|
||||||
: isolate_(Initialize(event_loop, setup_wasm_streaming)),
|
: isolate_holder_{CreateIsolateHolder(
|
||||||
isolate_holder_(CreateIsolateHolder(isolate_)),
|
Initialize(event_loop, setup_wasm_streaming))},
|
||||||
locker_(isolate_) {
|
isolate_{isolate_holder_.isolate()},
|
||||||
|
locker_{isolate_} {
|
||||||
isolate_->Enter();
|
isolate_->Enter();
|
||||||
|
|
||||||
v8::HandleScope scope(isolate_);
|
v8::HandleScope scope(isolate_);
|
||||||
|
|
|
@ -43,8 +43,12 @@ class JavascriptEnvironment {
|
||||||
v8::Isolate* Initialize(uv_loop_t* event_loop, bool setup_wasm_streaming);
|
v8::Isolate* Initialize(uv_loop_t* event_loop, bool setup_wasm_streaming);
|
||||||
std::unique_ptr<node::MultiIsolatePlatform> platform_;
|
std::unique_ptr<node::MultiIsolatePlatform> platform_;
|
||||||
|
|
||||||
raw_ptr<v8::Isolate> isolate_;
|
|
||||||
gin::IsolateHolder isolate_holder_;
|
gin::IsolateHolder isolate_holder_;
|
||||||
|
|
||||||
|
// owned-by: isolate_holder_
|
||||||
|
const raw_ptr<v8::Isolate> isolate_;
|
||||||
|
|
||||||
|
// depends-on: isolate_
|
||||||
v8::Locker locker_;
|
v8::Locker locker_;
|
||||||
|
|
||||||
std::unique_ptr<MicrotasksRunner> microtasks_runner_;
|
std::unique_ptr<MicrotasksRunner> microtasks_runner_;
|
||||||
|
|
Loading…
Reference in a new issue