diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-03-20 20:39:19 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-03-20 23:45:01 +0800 |
| commit | e23bd1552448f444ca0f97fcfd5c68016b2e7eb6 (patch) | |
| tree | ae623fd68bc5c42de1a697f12a2b10a3695d6990 | |
| parent | b57f5ff383f9f3093fecbe1c4bc05be6771cc1c0 (diff) | |
Revert "fix: use shared ptr properly"
This reverts commit 5c007b1581e7c36ce81de299e47c0c9ef51e9950.
revert until a solution is developed
| -rw-r--r-- | src/chatServer.cpp | 2 | ||||
| -rw-r--r-- | src/sessionManager.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/chatServer.cpp b/src/chatServer.cpp index 8605c75..8e9a3ab 100644 --- a/src/chatServer.cpp +++ b/src/chatServer.cpp @@ -39,7 +39,7 @@ void CChatServer::start() { initManagers(); // will await while waiting for accept() to return a new client - m_sessionManagerThread = std::jthread(&CSessionManager::run, g_pSessionManager); + m_sessionManagerThread = std::jthread(&CSessionManager::run, g_pSessionManager.get()); m_sessionManagerThread.detach(); while (true) { diff --git a/src/sessionManager.cpp b/src/sessionManager.cpp index c62402c..435c6dc 100644 --- a/src/sessionManager.cpp +++ b/src/sessionManager.cpp @@ -29,7 +29,7 @@ CSessionManager::~CSessionManager() { std::pair<std::jthread, std::shared_ptr<CSession>> *CSessionManager::newSession() { std::shared_ptr session = std::make_shared<CSession>(); - const auto instance = &m_vSessions.emplace_back(std::jthread(&CSession::run, session), session); + const auto instance = &m_vSessions.emplace_back(std::jthread(&CSession::run, session.get()), session); instance->second->setSelf(instance); return instance; } |
