Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Revert "stream_wrap: reference handle before uv_write2"
Browse files Browse the repository at this point in the history
It's segfaulting in release mode and asserting in debug mode:

  #
  # Fatal error in ../../deps/v8/src/api.h, line 297
  # CHECK(allow_empty_handle || that != __null) failed
  #

This reverts commit 99f0b02.
  • Loading branch information
bnoordhuis committed Jan 27, 2013
1 parent 99f0b02 commit 7f2a78b
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/stream_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ static Persistent<String> bytes_sym;
static Persistent<String> write_queue_size_sym;
static Persistent<String> onread_sym;
static Persistent<String> oncomplete_sym;
static Persistent<String> handle_sym;
static SlabAllocator* slab_allocator;
static bool initialized;

Expand Down Expand Up @@ -412,13 +411,6 @@ Handle<Value> StreamWrap::WriteStringImpl(const Arguments& args) {
StreamWrap* send_stream_wrap = static_cast<StreamWrap*>(
send_stream_obj->GetAlignedPointerFromInternalField(0));
send_stream = send_stream_wrap->GetStream();

// Reference StreamWrap instance to prevent it from being garbage
// collected before `AfterWrite` is called.
if (handle_sym.IsEmpty()) {
handle_sym = NODE_PSYMBOL("handle");
}
req_wrap->object_->Set(handle_sym, send_stream_obj);
}

r = uv_write2(&req_wrap->req_,
Expand Down Expand Up @@ -476,9 +468,6 @@ void StreamWrap::AfterWrite(uv_write_t* req, int status) {
assert(req_wrap->object_.IsEmpty() == false);
assert(wrap->object_.IsEmpty() == false);

// Unref handle property
req_wrap->object_->Delete(handle_sym);

if (status) {
SetErrno(uv_last_error(uv_default_loop()));
}
Expand Down

0 comments on commit 7f2a78b

Please sign in to comment.