mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
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:
parent
843b030eda
commit
1ff94c5f2d
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user