UICommon/NetPlayIndex: Fix possible crash when Add is called again

This commit is contained in:
Techjar 2019-04-10 22:39:16 -04:00
parent 0497b20955
commit f1e06b89da

View File

@ -197,6 +197,11 @@ bool NetPlayIndex::Add(NetPlaySession session)
m_player_count = session.player_count; m_player_count = session.player_count;
m_game = session.game_id; m_game = session.game_id;
m_session_thread_exit_event.Set();
if (m_session_thread.joinable())
m_session_thread.join();
m_session_thread_exit_event.Reset();
m_session_thread = std::thread([this] { NotificationLoop(); }); m_session_thread = std::thread([this] { NotificationLoop(); });
return true; return true;