DolphinWX: Prevent crash with Wiimote connected on start

wxWidgets causes a segfault if Host_ConnectWiimote is called and we try
to create an event from the Wiimote scanner thread while the GUI is
still initialising.
This commit is contained in:
Léo Lam 2016-07-25 07:54:17 +02:00
parent 843b030eda
commit 1ff94c5f2d

View File

@ -82,6 +82,8 @@ std::string wxStringTranslator(const char*);
CFrame* main_frame = nullptr;
static std::mutex s_init_mutex;
bool DolphinApp::Initialize(int& c, wxChar** v)
{
#if defined HAVE_X11 && HAVE_X11
@ -94,6 +96,7 @@ bool DolphinApp::Initialize(int& c, wxChar** v)
bool DolphinApp::OnInit()
{
std::lock_guard<std::mutex> lk(s_init_mutex);
if (!wxApp::OnInit())
return false;
@ -548,6 +551,7 @@ bool Host_RendererIsFullscreen()
void Host_ConnectWiimote(int wm_idx, bool connect)
{
std::lock_guard<std::mutex> lk(s_init_mutex);
if (connect)
{
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_FORCE_CONNECT_WIIMOTE1 + wm_idx);