Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9460 from jordan-woyak/wiimote-dc-crash-fix
WiimoteReal: Fix crash on real Wii Remote disconnect on Windows.
  • Loading branch information
leoetlino committed Jan 27, 2021
2 parents bc14e4a + bb2c50a commit 2537ea7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp
Expand Up @@ -916,7 +916,9 @@ static void TryToConnectBalanceBoard(std::unique_ptr<Wiimote> wm)
static void HandleWiimoteDisconnect(int index)
{
Core::RunAsCPUThread([index] {
g_wiimotes[index] = nullptr;
// The Wii Remote object must exist through the call to UpdateSource
// to prevent WiimoteDevice from having a dangling HIDWiimote pointer.
const auto temp_real_wiimote = std::move(g_wiimotes[index]);
WiimoteCommon::UpdateSource(index);
});
}
Expand Down

0 comments on commit 2537ea7

Please sign in to comment.