From c357531acb5965a75e2c14cd4173b925404a5c9f Mon Sep 17 00:00:00 2001 From: fearlessTobi Date: Sat, 16 Feb 2019 17:05:27 +0100 Subject: [PATCH] citra_qt/main: make SPEED_LIMIT_STEP static constexpr MSVC does not seem to like using constexpr values in a lambda that were declared outside of it. Previously on MSVC build the hotkeys to inc-/decrease the speed limit were not working correctly because in the lambda the SPEED_LIMIT_STEP had garbage values. After googling around a bit I found: https://github.com/codeplaysoftware/computecpp-sdk/issues/95 which seems to be a similar issue. Trying the suggested fix to make the variable static constexpr also fixes the bug here. --- src/citra_qt/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 5fb010f6d9..a8db6344f6 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -407,7 +407,9 @@ void GMainWindow::InitializeHotkeys() { Settings::values.use_frame_limit = !Settings::values.use_frame_limit; UpdateStatusBar(); }); - constexpr u16 SPEED_LIMIT_STEP = 5; + // We use "static" here in order to avoid capturing by lambda due to a MSVC bug, which makes the + // variable hold a garbage value after this function exits + static constexpr u16 SPEED_LIMIT_STEP = 5; connect(hotkey_registry.GetHotkey("Main Window", "Increase Speed Limit", this), &QShortcut::activated, this, [&] { if (Settings::values.frame_limit < 9999 - SPEED_LIMIT_STEP) {