mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-30 06:32:56 +00:00
InputCommon/ControllerEmu: Use more locks
Loading configs while another thread is messing with stuff just doesn't feel like a good idea Hopefully fixes Wiimote Scanning Thread crashes on startup
This commit is contained in:
parent
70bf89fa59
commit
f9c6eb7b98
@ -40,6 +40,8 @@ std::unique_lock<std::recursive_mutex> EmulatedController::GetStateLock()
|
|||||||
|
|
||||||
void EmulatedController::UpdateReferences(const ControllerInterface& devi)
|
void EmulatedController::UpdateReferences(const ControllerInterface& devi)
|
||||||
{
|
{
|
||||||
|
const auto lock = GetStateLock();
|
||||||
|
|
||||||
m_default_device_is_connected = devi.HasConnectedDevice(m_default_device);
|
m_default_device_is_connected = devi.HasConnectedDevice(m_default_device);
|
||||||
|
|
||||||
ciface::ExpressionParser::ControlEnvironment env(devi, GetDefaultDevice(), m_expression_vars);
|
ciface::ExpressionParser::ControlEnvironment env(devi, GetDefaultDevice(), m_expression_vars);
|
||||||
@ -138,6 +140,7 @@ void EmulatedController::SetDefaultDevice(ciface::Core::DeviceQualifier devq)
|
|||||||
|
|
||||||
void EmulatedController::LoadConfig(IniFile::Section* sec, const std::string& base)
|
void EmulatedController::LoadConfig(IniFile::Section* sec, const std::string& base)
|
||||||
{
|
{
|
||||||
|
const auto lock = GetStateLock();
|
||||||
std::string defdev = GetDefaultDevice().ToString();
|
std::string defdev = GetDefaultDevice().ToString();
|
||||||
if (base.empty())
|
if (base.empty())
|
||||||
{
|
{
|
||||||
@ -151,6 +154,7 @@ void EmulatedController::LoadConfig(IniFile::Section* sec, const std::string& ba
|
|||||||
|
|
||||||
void EmulatedController::SaveConfig(IniFile::Section* sec, const std::string& base)
|
void EmulatedController::SaveConfig(IniFile::Section* sec, const std::string& base)
|
||||||
{
|
{
|
||||||
|
const auto lock = GetStateLock();
|
||||||
const std::string defdev = GetDefaultDevice().ToString();
|
const std::string defdev = GetDefaultDevice().ToString();
|
||||||
if (base.empty())
|
if (base.empty())
|
||||||
sec->Set(/*std::string(" ") +*/ base + "Device", defdev, "");
|
sec->Set(/*std::string(" ") +*/ base + "Device", defdev, "");
|
||||||
@ -161,6 +165,7 @@ void EmulatedController::SaveConfig(IniFile::Section* sec, const std::string& ba
|
|||||||
|
|
||||||
void EmulatedController::LoadDefaults(const ControllerInterface& ciface)
|
void EmulatedController::LoadDefaults(const ControllerInterface& ciface)
|
||||||
{
|
{
|
||||||
|
const auto lock = GetStateLock();
|
||||||
// load an empty inifile section, clears everything
|
// load an empty inifile section, clears everything
|
||||||
IniFile::Section sec;
|
IniFile::Section sec;
|
||||||
LoadConfig(&sec);
|
LoadConfig(&sec);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user