mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
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>
This commit is contained in:
1 parent
98a7026311
commit
e67df04df2
1 file changed
+3
-1
@@ -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"
|
||||
@@ -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() {
|
||||
|
||||
Reference in new issue
Block a user