Skip to content

Commit

Permalink
src: use BaseObjectPtr in StreamReq::Dispose
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell authored and codebytere committed Jun 9, 2020
1 parent 98a7026 commit e67df04
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/stream_base-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "async_wrap-inl.h"
#include "base_object-inl.h"
#include "node.h"
#include "stream_base.h"
#include "v8.h"
Expand Down Expand Up @@ -36,9 +37,10 @@ inline StreamReq* StreamReq::FromObject(v8::Local<v8::Object> req_wrap_obj) {
}

inline void StreamReq::Dispose() {
BaseObjectPtr<AsyncWrap> destroy_me{GetAsyncWrap()};
object()->SetAlignedPointerInInternalField(
StreamReq::kStreamReqField, nullptr);
delete this;
destroy_me->Detach();
}

inline v8::Local<v8::Object> StreamReq::object() {
Expand Down

0 comments on commit e67df04

Please sign in to comment.