Merge pull request #1558 from comex/command-thread-mismatch

Fix wxCommandEvent/wxThreadEvent subclass mismatch
This commit is contained in:
Lioncash 2014-11-16 00:03:35 -05:00
commit c0291d5b88
1 changed files with 6 additions and 7 deletions

View File

@ -474,7 +474,7 @@ void NetPlayDiag::StopGame()
// NetPlayUI methods called from ---NETPLAY--- thread // NetPlayUI methods called from ---NETPLAY--- thread
void NetPlayDiag::Update() void NetPlayDiag::Update()
{ {
wxCommandEvent evt(wxEVT_THREAD, 1); wxThreadEvent evt(wxEVT_THREAD, 1);
GetEventHandler()->AddPendingEvent(evt); GetEventHandler()->AddPendingEvent(evt);
} }
@ -487,15 +487,14 @@ void NetPlayDiag::AppendChat(const std::string& msg)
void NetPlayDiag::OnMsgChangeGame(const std::string& filename) void NetPlayDiag::OnMsgChangeGame(const std::string& filename)
{ {
wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_CHANGE_GAME); wxThreadEvent* evt = new wxThreadEvent(wxEVT_THREAD, NP_GUI_EVT_CHANGE_GAME);
// TODO: using a wxString in AddPendingEvent from another thread is unsafe i guess? evt->SetString(StrToWxStr(filename));
evt.SetString(StrToWxStr(filename)); GetEventHandler()->QueueEvent(evt);
GetEventHandler()->AddPendingEvent(evt);
} }
void NetPlayDiag::OnMsgStartGame() void NetPlayDiag::OnMsgStartGame()
{ {
wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_START_GAME); wxThreadEvent evt(wxEVT_THREAD, NP_GUI_EVT_START_GAME);
GetEventHandler()->AddPendingEvent(evt); GetEventHandler()->AddPendingEvent(evt);
if (m_start_btn) if (m_start_btn)
m_start_btn->Disable(); m_start_btn->Disable();
@ -504,7 +503,7 @@ void NetPlayDiag::OnMsgStartGame()
void NetPlayDiag::OnMsgStopGame() void NetPlayDiag::OnMsgStopGame()
{ {
wxCommandEvent evt(wxEVT_THREAD, NP_GUI_EVT_STOP_GAME); wxThreadEvent evt(wxEVT_THREAD, NP_GUI_EVT_STOP_GAME);
GetEventHandler()->AddPendingEvent(evt); GetEventHandler()->AddPendingEvent(evt);
if (m_start_btn) if (m_start_btn)
m_start_btn->Enable(); m_start_btn->Enable();