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