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:
authorAnna Henningsen <anna@addaleax.net>2019-06-10 16:02:06 +0300
committerRich Trott <rtrott@gmail.com>2019-06-18 01:29:19 +0300
commit2a9f1ad4b0c725e0362d33e265dc22271c3466e7 (patch)
treeac6545d9b194ba783c444c35617c7af40473f5af /src/base_object-inl.h
parent14be3aa6e6149122b07f7b8513de290eea0aa2ec (diff)
http2: refactor ping + settings object lifetime management
Have clearer ownership relations between the `Http2Ping`, `Http2Settings` and `Http2Session` objects. Ping and Settings objects are now owned by the `Http2Session` instance, and deleted along with it, so neither type of object refers to the session after it is gone. In the case of `Http2Ping`s, that deletion is slightly delayed, so we explicitly reset its `session_` property. Fixes: https://github.com/nodejs/node/issues/28088 PR-URL: https://github.com/nodejs/node/pull/28150 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src/base_object-inl.h')
-rw-r--r--src/base_object-inl.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/base_object-inl.h b/src/base_object-inl.h
index 50d8aba4a94..af69084f4a5 100644
--- a/src/base_object-inl.h
+++ b/src/base_object-inl.h
@@ -40,9 +40,8 @@ BaseObject::BaseObject(Environment* env, v8::Local<v8::Object> object)
env_->AddCleanupHook(DeleteMe, static_cast<void*>(this));
}
-
BaseObject::~BaseObject() {
- env_->RemoveCleanupHook(DeleteMe, static_cast<void*>(this));
+ RemoveCleanupHook();
if (persistent_handle_.IsEmpty()) {
// This most likely happened because the weak callback below cleared it.
@@ -55,6 +54,9 @@ BaseObject::~BaseObject() {
}
}
+void BaseObject::RemoveCleanupHook() {
+ env_->RemoveCleanupHook(DeleteMe, static_cast<void*>(this));
+}
v8::Global<v8::Object>& BaseObject::persistent() {
return persistent_handle_;