We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b9521e8 commit 7ead6e2Copy full SHA for 7ead6e2
1 file changed
src/node_api.cc
@@ -67,14 +67,15 @@ void node_napi_env__::EnqueueFinalizer(v8impl::RefTracker* finalizer) {
67
}
68
69
void node_napi_env__::DrainFinalizerQueue() {
70
- // Process all pending finalizers. If new finalizers are added during
71
- // Finalize() calls,
72
- // they are handled in subsequent recursive calls.
+ // Process all pending finalizers in a loop. Any finalizers added
+ // during Finalize() will be picked up by the same loop until the queue is
+ // empty.
73
+
74
while (!pending_finalizers.empty()) {
75
decltype(pending_finalizers) current_finalizers;
76
current_finalizers.swap(pending_finalizers);
77
- for (auto* ref_tracker : current_finalizers) {
78
+ for (v8impl::RefTracker* ref_tracker : current_finalizers) {
79
ref_tracker->Finalize();
80
81
0 commit comments