aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/main_window.cpp
diff options
context:
space:
mode:
authorkraibse <33869366+kraibse@users.noreply.github.com>2026-10-30 01:15:40 +0100
committerkraibse <33869366+kraibse@users.noreply.github.com>2026-10-30 01:16:24 +0100
commitd56039ace99338293658f931a871e4dba203e3ab (patch)
tree80cfe34a4bb3732f38d10cf3632148c211607241 /src/yuzu/main_window.cpp
parentdfa55d1679758dc8e5b80374c230bae5a733c6c8 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'src/yuzu/main_window.cpp')
-rw-r--r--src/yuzu/main_window.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp
index 38fa28b80f..13359620dd 100644
--- a/src/yuzu/main_window.cpp
+++ b/src/yuzu/main_window.cpp
@@ -2135,7 +2135,11 @@ void MainWindow::OnEmulationStopped() {
shutdown_timer.stop();
if (QtCommon::emu_thread) {
QtCommon::emu_thread->disconnect();
- QtCommon::emu_thread->wait();
+ if (!QtCommon::emu_thread->wait(QDeadlineTimer(10'000))) {
+ LOG_ERROR(Frontend, "Emulation thread failed to stop, terminating it");
+ QtCommon::emu_thread->terminate();
+ QtCommon::emu_thread->wait();
+ }
QtCommon::emu_thread.reset();
}