From 0cad5f50547bb230bf52d05c5d09a29cd190a056 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Tue, 15 Sep 2026 15:04:08 +1000 Subject: [PATCH] VideoThread: Dispatch thread toggle failures safely Run fatal reconfiguration handling through the active video execution context so video-owned teardown and thread assertions execute on the correct thread. --- src/core/video_thread.cpp | 5 +++-- src/duckstation-qt/mainwindow.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/video_thread.cpp b/src/core/video_thread.cpp index bb61af437..9a96c5501 100644 --- a/src/core/video_thread.cpp +++ b/src/core/video_thread.cpp @@ -1128,8 +1128,9 @@ void VideoThread::SetThreadEnabled(bool enabled) if (!Reconfigure(requested_renderer, requested_renderer.has_value(), fullscreen_state, requested_fullscreen_ui, true, &error)) { - ERROR_LOG("Reconfigure failed: {}", error.GetDescription()); - ReportFatalErrorAndShutdown(fmt::format("Reconfigure failed: {}", error.GetDescription())); + std::string message = fmt::format("Reconfigure failed: {}", error.GetDescription()); + ERROR_LOG(message); + RunOnThreadAndSync([message = std::move(message)]() { ReportFatalErrorAndShutdown(message); }); } } diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 693d002c3..50955525a 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -800,7 +800,7 @@ void MainWindow::recreate() show(); // We need to close input sources, because e.g. DInput uses our window handle. - Host::RunOnCoreThread(&InputManager::CloseSources, true); + Host::RunOnCoreThread(&InputManager::CloseSources); // Ensure we don't get a display widget creation sent to us. const bool was_display_created = hasDisplayWidget();