From ef2269902052701ccc378014623ee8be8d95f442 Mon Sep 17 00:00:00 2001 From: Collecting Date: Sat, 31 Jan 2026 22:39:59 +0100 Subject: [PATCH] Fix: Defer EmuThread start to fix shortcut launch hang a race condition where the BootGame() function was called directly from the GMainWindow constructor. This would create and start the EmuThread before the main Qt application event loop (app.exec()) had begun. As a result, the LoadingScreen UI was not fully initialized and could not properly process the progress signals from the background emulation thread, causing the hang. The fix defers the call to emu_thread->start() by wrapping it in a QTimer::singleShot(0, ...) with a lambda function. This places the start command on the Qt event queue, ensuring it only executes after the GMainWindow has been fully constructed and the event loop is active. This guarantees the UI is ready to receive signals, resolving the race condition. Signed-off-by: Collecting --- src/citron/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/citron/main.cpp b/src/citron/main.cpp index e822bccb0..7d6e188bc 100644 --- a/src/citron/main.cpp +++ b/src/citron/main.cpp @@ -2183,8 +2183,8 @@ void GMainWindow::BootGame(const QString& filename, Service::AM::FrontendAppletP connect(emu_thread.get(), &EmuThread::LoadProgress, loading_screen, &LoadingScreen::OnLoadProgress, Qt::QueuedConnection); - // Start the thread AFTER all connections are set up - emu_thread->start(); + // Start the thread AFTER all connections are set up and the event loop has started + QTimer::singleShot(0, this, [this] { emu_thread->start(); }); // Update the GUI UpdateStatusButtons();