Skip to content

Commit

Permalink
fixup!
Browse files Browse the repository at this point in the history
  • Loading branch information
legendecas committed Apr 10, 2023
1 parent 85e2a4d commit 4582785
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/node_realm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ using v8::Value;
Realm::Realm(Environment* env, v8::Local<v8::Context> context, Kind kind)
: env_(env), isolate_(context->GetIsolate()), kind_(kind) {
context_.Reset(isolate_, context);
binding_data_store_.fill(nullptr);
}

Realm::~Realm() {
Expand Down
10 changes: 1 addition & 9 deletions src/node_shadow_realm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,7 @@ void ShadowRealm::WeakCallback(const v8::WeakCallbackInfo<ShadowRealm>& data) {
// This is necessary to avoid cleaning up base objects before their scheduled
// weak callbacks are invoked, which can lead to accessing to v8 apis during
// the first pass of the weak callback.
data.SetSecondPassCallback(SecondPassWeakCallback);
}

// static
void ShadowRealm::SecondPassWeakCallback(
const v8::WeakCallbackInfo<ShadowRealm>& data) {
ShadowRealm* realm = data.GetParameter();
// Delete the realm and run cleanup hooks.
delete realm;
realm->env()->SetImmediate([realm](Environment* env) { delete realm; });
}

ShadowRealm::ShadowRealm(Environment* env)
Expand Down
2 changes: 0 additions & 2 deletions src/node_shadow_realm.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class ShadowRealm : public Realm {

private:
static void WeakCallback(const v8::WeakCallbackInfo<ShadowRealm>& data);
static void SecondPassWeakCallback(
const v8::WeakCallbackInfo<ShadowRealm>& data);

explicit ShadowRealm(Environment* env);
~ShadowRealm();
Expand Down

0 comments on commit 4582785

Please sign in to comment.