| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -398,7 +398,11 @@ void Environment::RegisterHandleCleanups() { | |||
| 398 | 398 | void* arg) { | |
| 399 | 399 | handle->data = env; | |
| 400 | 400 | ||
| 401 | - env->CloseHandle(handle, [](uv_handle_t* handle) {}); | ||
| 401 | + env->CloseHandle(handle, [](uv_handle_t* handle) { | ||
| 402 | + #ifdef DEBUG | ||
| 403 | + memset(handle, 0xab, uv_handle_size(handle->type)); | ||
| 404 | + #endif | ||
| 405 | + }); | ||
| 402 | 406 | }; | |
| 403 | 407 | ||
| 404 | 408 | RegisterHandleCleanup( | |
@@ -512,6 +516,7 @@ void Environment::PrintSyncTrace() const { | |||
| 512 | 516 | } | |
| 513 | 517 | ||
| 514 | 518 | void Environment::RunCleanup() { | |
| 519 | + started_cleanup_ = true; | ||
| 515 | 520 | TraceEventScope trace_scope(TRACING_CATEGORY_NODE1(environment), | |
| 516 | 521 | "RunCleanup", this); | |
| 517 | 522 | CleanupHandles(); | |
@@ -660,10 +665,13 @@ void Environment::RunAndClearNativeImmediates() { | |||
| 660 | 665 | ||
| 661 | 666 | ||
| 662 | 667 | void Environment::ScheduleTimer(int64_t duration_ms) { | |
| 668 | + if (started_cleanup_) return; | ||
| 663 | 669 | uv_timer_start(timer_handle(), RunTimers, duration_ms, 0); | |
| 664 | 670 | } | |
| 665 | 671 | ||
| 666 | 672 | void Environment::ToggleTimerRef(bool ref) { | |
| 673 | + if (started_cleanup_) return; | ||
| 674 | + | ||
| 667 | 675 | if (ref) { | |
| 668 | 676 | uv_ref(reinterpret_cast<uv_handle_t*>(timer_handle())); | |
| 669 | 677 | } else { | |
@@ -763,6 +771,8 @@ void Environment::CheckImmediate(uv_check_t* handle) { | |||
| 763 | 771 | } | |
| 764 | 772 | ||
| 765 | 773 | void Environment::ToggleImmediateRef(bool ref) { | |
| 774 | + if (started_cleanup_) return; | ||
| 775 | + | ||
| 766 | 776 | if (ref) { | |
| 767 | 777 | // Idle handle is needed only to stop the event loop from blocking in poll. | |
| 768 | 778 | uv_idle_start(immediate_idle_handle(), [](uv_idle_t*){ }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1177,6 +1177,7 @@ class Environment { | |||
| 1177 | 1177 | CleanupHookCallback::Hash, | |
| 1178 | 1178 | CleanupHookCallback::Equal> cleanup_hooks_; | |
| 1179 | 1179 | uint64_t cleanup_hook_counter_ = 0; | |
| 1180 | + bool started_cleanup_ = false; | ||
| 1180 | 1181 | ||
| 1181 | 1182 | static void EnvPromiseHook(v8::PromiseHookType type, | |
| 1182 | 1183 | v8::Local<v8::Promise> promise, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments