From 3e030587c7ec5c2960f0dbd363aace9cb74e0b74 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 17 Nov 2022 13:00:52 -0500 Subject: [PATCH] Only close the auto-login window when login succeeds This prevents edge cases where the patcher window opens for a second, and then the entire application closes and the game never launches due to the auto-login window closing too early. --- launcher/desktop/src/autologinwindow.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/launcher/desktop/src/autologinwindow.cpp b/launcher/desktop/src/autologinwindow.cpp index e12f9e4..33df08c 100644 --- a/launcher/desktop/src/autologinwindow.cpp +++ b/launcher/desktop/src/autologinwindow.cpp @@ -27,14 +27,19 @@ AutoLoginWindow::AutoLoginWindow(DesktopInterface& interface, ProfileSettings& p mainLayout->addWidget(cancelButton); auto autologinTimer = new QTimer(); + connect(autologinTimer, &QTimer::timeout, [&, this, autologinTimer] { core.autoLogin(profile); - - close(); - autologinTimer->stop(); }); + connect(this, &AutoLoginWindow::loginCanceled, [autologinTimer] { autologinTimer->stop(); }); + + connect(&core, &LauncherCore::successfulLaunch, [this, autologinTimer] { + close(); + autologinTimer->stop(); + }); + autologinTimer->start(5000); } \ No newline at end of file