From de7c55a1e8d3dda20ee3dc408612f2ddb309e888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= Date: Thu, 7 Aug 2025 12:21:54 +0200 Subject: [PATCH 09/13] fix a possible bad_weak_ptr exception Organization: Wires Change-Id: I8c7f7a943a1d848f15527988cb76c2a0a10089e6 Fixes: 4eae6200 (close long-lived connections on SIGTERM) Signed-off-by: Joachim Wiberg --- src/http/EventStream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http/EventStream.cpp b/src/http/EventStream.cpp index 3bdd55e..8703dad 100644 --- a/src/http/EventStream.cpp +++ b/src/http/EventStream.cpp @@ -47,7 +47,7 @@ EventStream::EventStream(const server::request& req, } state = WantToClose; - boost::asio::post(this->res.io_service(), [weak = std::weak_ptr{shared_from_this()}]() { + boost::asio::post(this->res.io_service(), [weak = weak_from_this()]() { if (auto myself = weak.lock()) { std::lock_guard lock{myself->mtx}; if (myself->state == WantToClose) { // resume unless somebody closed it before this was picked up by the event loop -- 2.43.0