Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2020-04-27 23:01:13 +0300
committerJames M Snell <jasnell@gmail.com>2020-05-06 17:56:47 +0300
commit1dc006ef1990d4dcb67a9521bc643638aeba248b (patch)
treef239719455487fb17bb11d13e204ad0ec838f7c9 /src/stream_base-inl.h
parent120d7076d5462f7f664ed0c92be26541e3298a24 (diff)
src: use BaseObjectPtr in StreamReq::Dispose
Allow the AsyncWrap to be properly detached. Extracted from the [QUIC PR](https://github.com/nodejs/node/pull/32379). Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/33102 Refs: https://github.com/nodejs/node/pull/32379/files?file-filters%5B%5D=.bat&file-filters%5B%5D=.gyp&file-filters%5B%5D=.gypi&file-filters%5B%5D=.h&file-filters%5B%5D=.md&file-filters%5B%5D=.py&file-filters%5B%5D=.sh&file-filters%5B%5D=No+extension&file-filters%5B%5D=dotfile#r409084763 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/stream_base-inl.h')
-rw-r--r--src/stream_base-inl.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h
index 95152e34915..9660cc386ce 100644
--- a/src/stream_base-inl.h
+++ b/src/stream_base-inl.h
@@ -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"
@@ -31,9 +32,10 @@ StreamReq* StreamReq::FromObject(v8::Local<v8::Object> req_wrap_obj) {
}
void StreamReq::Dispose() {
- std::unique_ptr<StreamReq> ptr(this);
+ BaseObjectPtr<AsyncWrap> destroy_me{GetAsyncWrap()};
object()->SetAlignedPointerInInternalField(
StreamReq::kStreamReqField, nullptr);
+ destroy_me->Detach();
}
v8::Local<v8::Object> StreamReq::object() {