UICommon/NetPlayIndex: Fix random segfaults after quitting NetPlay

We can't join a detached thread, so NetPlayIndex gets deleted before
the notification thread exits, creating a race condition. We switch to
using Common::Event because just sleeping leaves the UI hung on the
thread join for a few seconds.
This commit is contained in:
Techjar
2019-04-06 08:09:20 -04:00
parent 23986d48f7
commit dc552f2cbb
2 changed files with 6 additions and 13 deletions

View File

@ -11,7 +11,7 @@
#include <utility>
#include <vector>
#include "Common/Flag.h"
#include "Common/Event.h"
struct NetPlaySession
{
@ -54,8 +54,6 @@ public:
private:
void NotificationLoop();
Common::Flag m_running;
std::string m_secret;
std::string m_game;
int m_player_count = 0;
@ -63,4 +61,6 @@ private:
std::string m_last_error;
std::thread m_session_thread;
Common::Event m_session_thread_exit_event;
};