mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-03 11:38:49 -06:00
PowerPC: Add RAII handling for breakpoint updates
bbf72e7
made a change where you can pass `false` to certain MemChecks
functions to get them to skip performing an "update" step. It was then
up to the caller to call the Update function later.
This commit changes the implementation so that, instead of the caller
passing in a boolean that controls whether a function calls Update, the
function now returns an object that on destruction will call Update.
Callers that are fine with Update being called right away can skip
storing the object in a variable and thereby call Update immediately,
and callers that want to call Update later can keep the object around.
This new design reduces the risk that someone will forget calling
Update.
This commit is contained in:
@ -996,6 +996,7 @@ void MemoryViewWidget::ToggleBreakpoint(u32 addr, bool row)
|
||||
|
||||
{
|
||||
const Core::CPUThreadGuard guard(m_system);
|
||||
DelayedMemCheckUpdate delayed_update(&memchecks);
|
||||
|
||||
for (int i = 0; i < breaks; i++)
|
||||
{
|
||||
@ -1014,16 +1015,14 @@ void MemoryViewWidget::ToggleBreakpoint(u32 addr, bool row)
|
||||
check.log_on_hit = m_do_log;
|
||||
check.break_on_hit = true;
|
||||
|
||||
memchecks.Add(std::move(check), false);
|
||||
delayed_update |= memchecks.Add(std::move(check));
|
||||
}
|
||||
else if (check_ptr != nullptr)
|
||||
{
|
||||
// Using the pointer fixes misaligned breakpoints (0x11 breakpoint in 0x10 aligned view).
|
||||
memchecks.Remove(check_ptr->start_address, false);
|
||||
delayed_update |= memchecks.Remove(check_ptr->start_address);
|
||||
}
|
||||
}
|
||||
|
||||
memchecks.Update();
|
||||
}
|
||||
|
||||
emit Host::GetInstance()->PPCBreakpointsChanged();
|
||||
|
Reference in New Issue
Block a user