src: keep object alive in stream_pipe code

This was overlooked in a489583eda.

Refs: https://github.com/nodejs/node/pull/30374

PR-URL: https://github.com/nodejs/node/pull/30666
Fixes: https://github.com/nodejs/node/issues/30643
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Anna Henningsen committed 2019-11-28 17:49:10 +01:00
1 parent 8792c3feb8
commit f73716d35a
1 file changed
+1 -1
+1 -1
View File
@@ -72,7 +72,7 @@ void StreamPipe::Unpipe() {
// inside the garbage collector, so we can’t run JS here.
HandleScope handle_scope(env()->isolate());
BaseObjectPtr<StreamPipe> strong_ref{this};
env()->SetImmediate([this](Environment* env) {
env()->SetImmediate([this, strong_ref](Environment* env) {
HandleScope handle_scope(env->isolate());
Context::Scope context_scope(env->context());
Local<Object> object = this->object();