diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 6bd73ae3baf374..91d139ac9cd236 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -9,6 +9,7 @@ #include "req-wrap-inl.h" #include "tree.h" #include "util.h" +#include "util-inl.h" #include "uv.h" #include @@ -258,6 +259,7 @@ class QueryWrap : public AsyncWrap { virtual ~QueryWrap() override { CHECK_EQ(false, persistent().IsEmpty()); + ClearWrap(object()); persistent().Reset(); } diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc index b3ef152a2ec1b0..c5792338af2fec 100644 --- a/src/handle_wrap.cc +++ b/src/handle_wrap.cc @@ -98,7 +98,7 @@ void HandleWrap::OnClose(uv_handle_t* handle) { if (have_close_callback) wrap->MakeCallback(env->onclose_string(), 0, nullptr); - wrap->object()->SetAlignedPointerInInternalField(0, nullptr); + ClearWrap(wrap->object()); wrap->persistent().Reset(); delete wrap; } diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 71799d0bfa3ef3..71e1272e9dc361 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -5023,6 +5023,7 @@ class PBKDF2Request : public AsyncWrap { ~PBKDF2Request() override { release(); + ClearWrap(object()); persistent().Reset(); } @@ -5288,6 +5289,7 @@ class RandomBytesRequest : public AsyncWrap { } ~RandomBytesRequest() override { + ClearWrap(object()); persistent().Reset(); } diff --git a/src/req-wrap-inl.h b/src/req-wrap-inl.h index 63229260ec7517..653babd2a70c65 100644 --- a/src/req-wrap-inl.h +++ b/src/req-wrap-inl.h @@ -28,6 +28,7 @@ template ReqWrap::~ReqWrap() { CHECK_EQ(req_.data, this); // Assert that someone has called Dispatched(). CHECK_EQ(false, persistent().IsEmpty()); + ClearWrap(object()); persistent().Reset(); }