http2,tls: store WriteWrap using BaseObjectPtr
Create weak `WriteWrap` and `ShutdownWrap` objects, and when referencing them in C++ is necessary, use `BaseObjectPtr<>` instead of plain pointers to keep these objects from being garbage-collected. This solves issues that arise when the underlying `StreamBase` instance is weak, but the `WriteWrap` or `ShutdownWrap` instances are not; in that case, they would otherwise potentially stick around in memory after the stream that they originally belong to is long gone. It probably makes sense to use `BaseObjectptr<>` more extensively in `StreamBase` in the long run as well. PR-URL: https://github.com/nodejs/node/pull/35488 Reviewed-By:James M Snell <jasnell@gmail.com> Reviewed-By:
Matteo Collina <matteo.collina@gmail.com>
parent
fb2f3cc8
Please register or sign in to comment