Qt/debugger: fix some possible crashes and inconsistencies in the breakpoint widget

One, which was also possible in Wx is to add an mbp after the core stopped which shouldn't be possible as it needs to add the memcheck on the core thread which wouldn't be running.  The other fix is Qt specific where it doesn't clear the breakpoints on stop.
This commit is contained in:
aldelaro5
2018-05-06 01:55:30 -04:00
parent 09792fde70
commit 7388774f10

View File

@ -40,8 +40,16 @@ BreakpointWidget::BreakpointWidget(QWidget* parent) : QDockWidget(parent)
if (!Settings::Instance().IsDebugModeEnabled()) if (!Settings::Instance().IsDebugModeEnabled())
return; return;
m_load->setEnabled(Core::IsRunning()); bool is_initialised = state != Core::State::Uninitialized;
m_save->setEnabled(Core::IsRunning()); m_new->setEnabled(is_initialised);
m_load->setEnabled(is_initialised);
m_save->setEnabled(is_initialised);
if (!is_initialised)
{
PowerPC::breakpoints.Clear();
PowerPC::memchecks.Clear();
Update();
}
}); });
connect(&Settings::Instance(), &Settings::BreakpointsVisibilityChanged, connect(&Settings::Instance(), &Settings::BreakpointsVisibilityChanged,
@ -101,6 +109,7 @@ void BreakpointWidget::CreateWidgets()
m_load = AddAction(m_toolbar, tr("Load"), this, &BreakpointWidget::OnLoad); m_load = AddAction(m_toolbar, tr("Load"), this, &BreakpointWidget::OnLoad);
m_save = AddAction(m_toolbar, tr("Save"), this, &BreakpointWidget::OnSave); m_save = AddAction(m_toolbar, tr("Save"), this, &BreakpointWidget::OnSave);
m_new->setEnabled(false);
m_load->setEnabled(false); m_load->setEnabled(false);
m_save->setEnabled(false); m_save->setEnabled(false);