Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix random crash when using the cheat search #13071

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

Pokechu22
Copy link
Contributor

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.

>	Dolphin.exe!CheatSearchWidget::RefreshGUICurrentValues(unsigned __int64 begin_index, unsigned __int64 end_index) Line 608	C++
 	Dolphin.exe!CheatSearchWidget::UpdateTableRows(const Core::CPUThreadGuard & guard, unsigned __int64 begin_index, unsigned __int64 end_index, CheatSearchWidget::UpdateSource source) Line 412	C++
 	Dolphin.exe!CheatSearchWidget::UpdateTableVisibleCurrentValues(CheatSearchWidget::UpdateSource source) Line 425	C++
 	[Inline Frame] Dolphin.exe!std::_Func_class<void>::operator()() Line 951	C++
 	[Inline Frame] Dolphin.exe!Common::HookableEvent<Common::StringLiteral<11>{char{86,73,69,110,100,70,105,101,108,100,0}}>::Trigger() Line 111	C++
 	Dolphin.exe!VideoInterface::VideoInterfaceManager::EndField(FieldType field, unsigned __int64 ticks) Line 843	C++
 	Dolphin.exe!VideoInterface::VideoInterfaceManager::Update(unsigned __int64 ticks) Line 881	C++
 	Dolphin.exe!SystemTimers::SystemTimersManager::VICallback(Core::System & system, unsigned __int64 userdata, __int64 cycles_late) Line 143	C++
 	[Inline Frame] Dolphin.exe!CoreTiming::CoreTimingManager::Advance() Line 348	C++
 	Dolphin.exe!CoreTiming::GlobalAdvance() Line 536	C++
 	0000025c260c8089()	Unknown
 	0000000000009032()	Unknown
 	0000025a940c0000()	Unknown
 	0000000000009032()	Unknown
 	0000000000000040()	Unknown
 	0000000000000001()	Unknown
 	ffffffffffffffff()	Unknown
 	0000026c3b6141d0()	Unknown

Unhandled exception thrown: read access violation.
__imp_QTableWidget::item(...) returned nullptr.

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.
Copy link
Contributor

@Dentomologist Dentomologist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a PR which addresses this and a number of other Cheat Search issues, but it hasn't been reviewed since I reworked it and it already needs a rebase anyway.

This PR is simple and effective enough that I think it's an easy merge to improve things in the meantime.

@JMC47 JMC47 merged commit 4bc1546 into dolphin-emu:master Sep 25, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants