From c5ff7edba9555aecc7b6699f943ca2da96b7bc28 Mon Sep 17 00:00:00 2001 From: zeromus Date: Thu, 23 Apr 2020 20:40:16 -0400 Subject: [PATCH] fiddle with race condition thing some more. uhhh full disclosure, I still got a crash once. Couldnt repro it (as compared to before where it was 100% fully reproducible for me. not sure why though --- BizHawk.Client.EmuHawk/Input/OTK_Gamepad.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/BizHawk.Client.EmuHawk/Input/OTK_Gamepad.cs b/BizHawk.Client.EmuHawk/Input/OTK_Gamepad.cs index 5c800a5874..cca48c1d04 100644 --- a/BizHawk.Client.EmuHawk/Input/OTK_Gamepad.cs +++ b/BizHawk.Client.EmuHawk/Input/OTK_Gamepad.cs @@ -29,7 +29,6 @@ namespace BizHawk.Client.EmuHawk /// Initialization is only called once when MainForm loads public static void Initialize() { - CloseAll(); var playerCount = 0; for (var i = 0; i < MAX_GAMEPADS; i++) { @@ -56,7 +55,8 @@ namespace BizHawk.Client.EmuHawk { lock (_syncObj) { - foreach (var device in Devices) device.Update(); + if (initialized) + foreach (var device in Devices) device.Update(); } } @@ -64,7 +64,8 @@ namespace BizHawk.Client.EmuHawk { lock (_syncObj) { - Devices.Clear(); + if (!initialized) + throw new InvalidOperationException("Well, however did this happen"); } }