@@ -542,8 +542,9 @@ struct Session::Impl final : public MemoryRetainer {
542542 remote_address_(config.remote_address),
543543 application_(SelectApplication(session, config_)),
544544 timer_(session_->env (), [this] {
545- auto impl = session_->impl_ ; // we hold a reference to ourself,
546- // as the reference from session to us may go away
545+ BaseObjectPtr<Session> session = BaseObjectPtr<Session>(session_);
546+ // we hold a reference to session,
547+ // as the reference from session to us may go away otherwise
547548 // while we call OnTimeout
548549 session_->OnTimeout ();
549550 }) {
@@ -562,10 +563,10 @@ struct Session::Impl final : public MemoryRetainer {
562563 state_->closing = 1 ;
563564 STAT_RECORD_TIMESTAMP (Stats, closing_at);
564565
565- // we hold a reference to ourself ,
566- // as the reference from session to us may go away
566+ // we hold a reference to our session ,
567+ // as the reference from session to us may go away otherwise
567568 // while we destroy streams
568- auto impl = session_-> impl_ ;
569+ BaseObjectPtr<Session> session = BaseObjectPtr<Session>(session_) ;
569570
570571 // Iterate through all of the known streams and close them. The streams
571572 // will remove themselves from the Session as soon as they are closed.
@@ -1306,7 +1307,7 @@ Session::Session(Endpoint* endpoint,
13061307 : AsyncWrap(endpoint->env (), object, PROVIDER_QUIC_SESSION),
13071308 side_(config.side),
13081309 allocator_(BindingData::Get(env())),
1309- impl_(std::make_shared <Impl>(this , endpoint, config)),
1310+ impl_(std::make_unique <Impl>(this , endpoint, config)),
13101311 connection_(InitConnection()),
13111312 tls_session_(tls_context->NewSession (this , session_ticket)) {
13121313 DCHECK (impl_);
0 commit comments