From f045632a786967dbdb7efd1f5c72125e37e02c61 Mon Sep 17 00:00:00 2001 From: Ayndpa Date: Wed, 19 Nov 2025 22:07:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96io=5Fcontext=E7=AE=A1?= =?UTF-8?q?=E7=90=86=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=B7=A5=E4=BD=9C=E4=BF=9D?= =?UTF-8?q?=E6=8A=A4=E5=92=8C=E7=BA=BF=E7=A8=8B=E5=A4=84=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E7=A1=AE=E4=BF=9D=E8=B5=84=E6=BA=90=E6=AD=A3=E7=A1=AE=E9=87=8A?= =?UTF-8?q?=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- online_game_tool.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/online_game_tool.cpp b/online_game_tool.cpp index 34878e1..3a3725f 100644 --- a/online_game_tool.cpp +++ b/online_game_tool.cpp @@ -35,6 +35,10 @@ int main() } boost::asio::io_context io_context; + auto work_guard = boost::asio::make_work_guard(io_context); + std::thread io_thread([&io_context]() { + io_context.run(); + }); // Initialize Steam Networking Manager SteamNetworkingManager steamManager; @@ -285,6 +289,15 @@ int main() { server->stop(); } + + // Stop io_context and join thread + work_guard.reset(); + io_context.stop(); + if (io_thread.joinable()) + { + io_thread.join(); + } + ImGui_ImplOpenGL3_Shutdown(); ImGui_ImplGlfw_Shutdown(); ImGui::DestroyContext();