From 3d0a8424962ff25a3a25107ba07d3cc2612f5187 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Tue, 19 Sep 2023 23:40:31 -0700 Subject: [PATCH] don't allow *this to be destroyed too early on idle timeout --- src/Client.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Client.cc b/src/Client.cc index be9805e8..e50f6456 100644 --- a/src/Client.cc +++ b/src/Client.cc @@ -245,7 +245,8 @@ void Client::idle_timeout() { this->log.info("Idle timeout expired"); auto s = this->server.lock(); if (s) { - s->disconnect_client(this->shared_from_this()); + auto c = this->shared_from_this(); + s->disconnect_client(c); } else { this->log.info("Server is deleted; cannot disconnect client"); }