mirror of
https://git.citron-emu.org/citron/emulator
synced 2026-02-03 08:03:36 +00:00
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 <collecting@noreply.localhost>
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user