Fix random crash when using the cheat search
Before, Dolphin would randomly crash when updating the cheat search when automatic refresh was enabled. (Having a large number of addresses listed, e.g. by starting with an "any value" search, may contribute). The crash was due to QTableWidget::item returning nullptr in RefreshGUICurrentValues, presumably due to the table being resized on the UI thread while the emulated CPU thread was updating the values. I've fixed this by pausing the CPU thread for the entirety of OnNextScanClicked; this eliminated crashes in my testing.
This commit is contained in:
parent
de67c4c93b
commit
b34b7f63ee
|
@ -280,6 +280,8 @@ void CheatSearchWidget::ConnectWidgets()
|
||||||
|
|
||||||
void CheatSearchWidget::OnNextScanClicked()
|
void CheatSearchWidget::OnNextScanClicked()
|
||||||
{
|
{
|
||||||
|
Core::CPUThreadGuard guard{m_system};
|
||||||
|
|
||||||
const bool had_old_results = m_session->WasFirstSearchDone();
|
const bool had_old_results = m_session->WasFirstSearchDone();
|
||||||
|
|
||||||
const auto filter_type = m_value_source_dropdown->currentData().value<Cheats::FilterType>();
|
const auto filter_type = m_value_source_dropdown->currentData().value<Cheats::FilterType>();
|
||||||
|
@ -304,7 +306,7 @@ void CheatSearchWidget::OnNextScanClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t old_count = m_session->GetResultCount();
|
const size_t old_count = m_session->GetResultCount();
|
||||||
const Cheats::SearchErrorCode error_code = m_session->RunSearch(Core::CPUThreadGuard{m_system});
|
const Cheats::SearchErrorCode error_code = m_session->RunSearch(guard);
|
||||||
|
|
||||||
if (error_code == Cheats::SearchErrorCode::Success)
|
if (error_code == Cheats::SearchErrorCode::Success)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue