diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-06-10 16:02:06 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-06-18 01:29:19 +0300 |
commit | 2a9f1ad4b0c725e0362d33e265dc22271c3466e7 (patch) | |
tree | ac6545d9b194ba783c444c35617c7af40473f5af /src/base_object.h | |
parent | 14be3aa6e6149122b07f7b8513de290eea0aa2ec (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.h')
-rw-r--r-- | src/base_object.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/base_object.h b/src/base_object.h index f616108a1d9..53bd4b00d60 100644 --- a/src/base_object.h +++ b/src/base_object.h @@ -83,6 +83,12 @@ class BaseObject : public MemoryRetainer { v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info); + protected: + // Can be used to avoid the automatic object deletion when the Environment + // exits, for example when this object is owned and deleted by another + // BaseObject at that point. + inline void RemoveCleanupHook(); + private: v8::Local<v8::Object> WrappedObject() const override; static void DeleteMe(void* data); |