Qt: Fix race condition when detaching a multiplayer game while running
Jeffrey Pfau jeffrey@endrift.com
Sun, 04 Sep 2016 09:31:14 -0700
1 files changed,
8 insertions(+),
0 deletions(-)
M
src/platform/qt/MultiplayerController.cpp
→
src/platform/qt/MultiplayerController.cpp
@@ -159,6 +159,9 @@ mCoreThread* thread = controller->thread();
if (!thread) { return; } + for (int i = 0; i < m_players.count(); ++i) { + m_players[i].controller->threadInterrupt(); + } #ifdef M_CORE_GBA if (controller->platform() == PLATFORM_GBA) { GBA* gba = static_cast<GBA*>(thread->core->board);@@ -171,11 +174,16 @@ delete node;
} } #endif + + controller->threadContinue(); for (int i = 0; i < m_players.count(); ++i) { if (m_players[i].controller == controller) { m_players.removeAt(i); break; } + } + for (int i = 0; i < m_players.count(); ++i) { + m_players[i].controller->threadContinue(); } emit gameDetached(); }