From d56039ace99338293658f931a871e4dba203e3ab Mon Sep 17 00:00:00 2001 From: kraibse <33869366+kraibse@users.noreply.github.com> Date: Fri, 30 Oct 2026 01:15:40 +0100 Subject: Fix hang on emulation stop when audio renderer outlives its manager The Switch 2 aud:u client hands out an IAudioRendererManager the guest may close right after opening a renderer. The Manager was owned by value and renderers held a plain reference, so it was destroyed (stopping the system manager thread) while the renderer lived on. System::Stop() then waited forever on terminate_event, hanging shutdown. - Share ownership of the audio Manager with each IAudioRenderer - Bound the terminate_event wait in System::Stop() - Bound the emu thread wait in MainWindow::OnEmulationStopped() Co-Authored-By: Claude Sonnet 5.5 --- src/audio_core/renderer/system.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/audio_core/renderer/system.cpp') diff --git a/src/audio_core/renderer/system.cpp b/src/audio_core/renderer/system.cpp index b7675ff5de..2e3e741d3e 100644 --- a/src/audio_core/renderer/system.cpp +++ b/src/audio_core/renderer/system.cpp @@ -444,7 +444,10 @@ void System::Stop() { } if (execution_mode == ExecutionMode::Auto) { - terminate_event.Wait(); + // The system manager thread signals this; it may already be gone during shutdown. + if (!terminate_event.WaitFor(std::chrono::seconds(1))) { + LOG_WARNING(Service_Audio, "Timed out waiting for the renderer to terminate"); + } } } -- cgit v1.2.3