| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6e01855 commit 8413759
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -374,8 +374,11 @@ class Reference : public RefBase { | |||
| 374 | 374 | inline void Finalize(bool is_env_teardown = false) override { | |
| 375 | 375 | // During env teardown, `~napi_env()` alone is responsible for finalizing. | |
| 376 | 376 | // Thus, we don't want any stray gc passes to trigger a second call to | |
| 377 | - // `Finalize()`, so let's reset the persistent here. | ||
| 378 | - if (is_env_teardown) _persistent.ClearWeak(); | ||
| 377 | + // `Finalize()`, so let's reset the persistent here if nothing is | ||
| 378 | + // keeping it alive. | ||
| 379 | + if (is_env_teardown && _persistent.IsWeak()) { | ||
| 380 | + _persistent.ClearWeak(); | ||
| 381 | + } | ||
| 379 | 382 | ||
| 380 | 383 | // Chain up to perform the rest of the finalization. | |
| 381 | 384 | RefBase::Finalize(is_env_teardown); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments