From 1a3b4d91bf8446909822e1527cb2aaa6c60cb1b8 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sun, 23 Feb 2020 09:34:31 -0600 Subject: [PATCH] InputCommon: Mark GetStateLock with [[nodiscard]] and fix discarding calls. --- Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp | 8 ++++---- Source/Core/InputCommon/ControllerEmu/ControllerEmu.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp index dd5768e3f2..0052278b90 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp @@ -71,7 +71,7 @@ MappingWindow::MappingWindow(QWidget* parent, Type type, int port_num) timer->start(1000 / INDICATOR_UPDATE_FREQ); - GetController()->GetStateLock(); + const auto lock = GetController()->GetStateLock(); emit ConfigChanged(); } @@ -245,7 +245,7 @@ void MappingWindow::OnLoadProfilePressed() m_controller->LoadConfig(ini.GetOrCreateSection("Profile")); m_controller->UpdateReferences(g_controller_interface); - GetController()->GetStateLock(); + const auto lock = GetController()->GetStateLock(); emit ConfigChanged(); } @@ -438,7 +438,7 @@ void MappingWindow::OnDefaultFieldsPressed() m_controller->LoadDefaults(g_controller_interface); m_controller->UpdateReferences(g_controller_interface); - GetController()->GetStateLock(); + const auto lock = GetController()->GetStateLock(); emit ConfigChanged(); emit Save(); } @@ -455,7 +455,7 @@ void MappingWindow::OnClearFieldsPressed() m_controller->UpdateReferences(g_controller_interface); - GetController()->GetStateLock(); + const auto lock = GetController()->GetStateLock(); emit ConfigChanged(); emit Save(); } diff --git a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h index 3f497b1f88..3301672ccf 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h +++ b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h @@ -153,7 +153,7 @@ public: // references and GetState(), by extension. This prevents a race condition // which happens while handling a hotplug event because a control reference's State() // could be called before we have finished updating the reference. - static std::unique_lock GetStateLock(); + [[nodiscard]] static std::unique_lock GetStateLock(); std::vector> groups;