summaryrefslogtreecommitdiff
path: root/src/stream_pipe.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/stream_pipe.cc')
-rw-r--r--src/stream_pipe.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/stream_pipe.cc b/src/stream_pipe.cc
index b84c8f4c66..d405c4d5cb 100644
--- a/src/stream_pipe.cc
+++ b/src/stream_pipe.cc
@@ -42,7 +42,7 @@ StreamPipe::StreamPipe(StreamBase* source,
}
StreamPipe::~StreamPipe() {
- Unpipe();
+ Unpipe(true);
}
StreamBase* StreamPipe::source() {
@@ -53,7 +53,7 @@ StreamBase* StreamPipe::sink() {
return static_cast<StreamBase*>(writable_listener_.stream());
}
-void StreamPipe::Unpipe() {
+void StreamPipe::Unpipe(bool is_in_deletion) {
if (is_closed_)
return;
@@ -68,6 +68,8 @@ void StreamPipe::Unpipe() {
source()->RemoveStreamListener(&readable_listener_);
sink()->RemoveStreamListener(&writable_listener_);
+ if (is_in_deletion) return;
+
// Delay the JS-facing part with SetImmediate, because this might be from
// inside the garbage collector, so we can’t run JS here.
HandleScope handle_scope(env()->isolate());