From e64e2d8cd512483259b2ca24b0a47f6f817c1fe3 Mon Sep 17 00:00:00 2001 From: Alayan <25536748+Alayan-stk-2@users.noreply.github.com> Date: Sun, 28 Apr 2024 21:43:42 +0200 Subject: [PATCH] Fix #4931 The assert could be triggered when a new sign-in request was sent before the first one was resolved, usually when using the enter key to request the sign in. Since it can happen in normal operations to have the player profile status different from signing out or signed out, an assert is incorrect. Also fix server-only compilation for the previous commit. --- src/online/online_player_profile.cpp | 10 +++++----- src/states_screens/options/options_screen_video.cpp | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/online/online_player_profile.cpp b/src/online/online_player_profile.cpp index 693391b13..6e21bdd59 100644 --- a/src/online/online_player_profile.cpp +++ b/src/online/online_player_profile.cpp @@ -107,7 +107,6 @@ namespace Online m_online_state = OS_SIGNED_OUT; m_token = ""; m_profile = NULL; - } // OnlinePlayerProfile // ------------------------------------------------------------------------ @@ -136,10 +135,11 @@ namespace Online void OnlinePlayerProfile::requestSignIn(const core::stringw &username, const core::stringw &password) { - // If the player changes the online account, there can be a - // logout stil happening. - assert(m_online_state == OS_SIGNED_OUT || - m_online_state == OS_SIGNING_OUT); + // Avoid multiple sign in requests from happening at once, + // this can occur for example when using the enter key to request a sign-in. + if (m_online_state != OS_SIGNED_OUT && m_online_state != OS_SIGNING_OUT) + return; + auto request = std::make_shared(); // We can't use setUserDetail here, since there is no token yet diff --git a/src/states_screens/options/options_screen_video.cpp b/src/states_screens/options/options_screen_video.cpp index 5c6de359c..e05d07b15 100644 --- a/src/states_screens/options/options_screen_video.cpp +++ b/src/states_screens/options/options_screen_video.cpp @@ -933,6 +933,7 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name, } // scale_rtts else if (name == "benchmarkCurrent") { +#ifndef SERVER_ONLY // TODO - Add the possibility to benchmark more tracks and define replay benchmarks in // a config file const std::string bf_bench("benchmark_black_forest.replay"); @@ -961,6 +962,7 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name, { startBenchmark(); } +#endif } // benchmarkCurrent // TODO - Add a standard benchmark testing multiple presets /*else if (name == "benchmarkStandard")