From 73c9cb4dfaa1da463534862813c3ea3a528a4b03 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 12 Mar 2025 14:49:35 +0800 Subject: cleanup: shared ptr .get() and std::move() use cases fixes a bug where dtor of CSession is not called --- src/sessionManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sessionManager.cpp') diff --git a/src/sessionManager.cpp b/src/sessionManager.cpp index d77c0ae..f5b29af 100644 --- a/src/sessionManager.cpp +++ b/src/sessionManager.cpp @@ -27,7 +27,7 @@ CSessionManager::~CSessionManager() { std::pair> *CSessionManager::newSession() { std::shared_ptr session = std::make_shared(); - const auto instance = &m_vSessions.emplace_back(std::jthread(&CSession::run, session), std::move(session)); + const auto instance = &m_vSessions.emplace_back(std::jthread(&CSession::run, session.get()), session); instance->second->setSelf(instance); return instance; } -- cgit v1.2.3