mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-04-17 22:01:26 -06:00
fix crash when closing before search, make discard a function for consistency
This commit is contained in:
parent
7ac0ed97f2
commit
8fa37f738c
@ -116,8 +116,7 @@ InputAPIAddWindow::InputAPIAddWindow(wxWindow* parent, const wxPoint& position,
|
||||
|
||||
InputAPIAddWindow::~InputAPIAddWindow()
|
||||
{
|
||||
std::lock_guard lock{m_search_thread_data->mutex};
|
||||
m_search_thread_data->discardResult = true;
|
||||
discard_thread_result();
|
||||
}
|
||||
|
||||
void InputAPIAddWindow::on_add_button(wxCommandEvent& event)
|
||||
@ -165,13 +164,11 @@ std::unique_ptr<ControllerProviderSettings> InputAPIAddWindow::get_settings() co
|
||||
|
||||
void InputAPIAddWindow::on_api_selected(wxCommandEvent& event)
|
||||
{
|
||||
discard_thread_result();
|
||||
|
||||
if (m_input_api->GetSelection() == wxNOT_FOUND)
|
||||
return;
|
||||
|
||||
m_search_running = false;
|
||||
if(m_search_thread_data)
|
||||
m_search_thread_data->discardResult = true;
|
||||
|
||||
m_controller_list->Enable();
|
||||
m_controller_list->SetSelection(wxNOT_FOUND);
|
||||
|
||||
@ -317,3 +314,13 @@ void InputAPIAddWindow::on_controllers_refreshed(wxCommandEvent& event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InputAPIAddWindow::discard_thread_result()
|
||||
{
|
||||
m_search_running = false;
|
||||
if(m_search_thread_data)
|
||||
{
|
||||
std::lock_guard lock{m_search_thread_data->mutex};
|
||||
m_search_thread_data->discardResult = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,6 +39,8 @@ private:
|
||||
void on_controller_selected(wxCommandEvent& event);
|
||||
void on_controllers_refreshed(wxCommandEvent& event);
|
||||
|
||||
void discard_thread_result();
|
||||
|
||||
wxChoice* m_input_api;
|
||||
wxComboBox* m_controller_list;
|
||||
wxButton* m_ok_button;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user