We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 530e69e commit ec4be2dCopy full SHA for ec4be2d
src/js_native_api_v8.cc
@@ -372,6 +372,9 @@ class Reference : public RefBase {
372
373
protected:
374
inline void Finalize(bool is_env_teardown = false) override {
375
+ if (is_env_teardown) env_teardown_finalize_started_ = true;
376
+ if (!is_env_teardown && env_teardown_finalize_started_) return;
377
+
378
// During env teardown, `~napi_env()` alone is responsible for finalizing.
379
// Thus, we don't want any stray gc passes to trigger a second call to
380
// `Finalize()`, so let's reset the persistent here if nothing is
@@ -405,6 +408,7 @@ class Reference : public RefBase {
405
408
data.GetParameter()->Finalize();
406
409
}
407
410
411
+ bool env_teardown_finalize_started_ = false;
412
v8impl::Persistent<v8::Value> _persistent;
413
};
414
0 commit comments