1
0
Fork 0

GUI: improve selection behavior when deleting the last breakpoint

This commit is contained in:
mrexodia 2017-08-14 15:53:44 +02:00
parent 6587cbc564
commit d5619a57e0
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
2 changed files with 14 additions and 4 deletions

View File

@ -36,9 +36,9 @@ BreakpointsView::BreakpointsView(QWidget* parent)
void BreakpointsView::setupContextMenu() void BreakpointsView::setupContextMenu()
{ {
mMenuBuilder = new MenuBuilder(this, [](QMenu*) mMenuBuilder = new MenuBuilder(this, [this](QMenu*)
{ {
return DbgIsDebugging(); return DbgIsDebugging() && isValidIndex(getInitialSelection(), ColType);
}); });
auto validBp = [this](QMenu*) auto validBp = [this](QMenu*)
@ -494,7 +494,14 @@ void BreakpointsView::updateBreakpointsSlot()
mRich.push_back(std::make_pair(std::move(richDisasm), std::move(richSummary))); mRich.push_back(std::make_pair(std::move(richDisasm), std::move(richSummary)));
} }
if(bpmap.count) if(bpmap.count)
{
BridgeFree(bpmap.bp); BridgeFree(bpmap.bp);
auto sel = getInitialSelection();
auto rows = getRowCount();
if(sel >= rows)
setSingleSelection(rows - 1);
}
reloadData(); reloadData();
} }

View File

@ -74,8 +74,11 @@ private:
bool isValidBp() bool isValidBp()
{ {
auto & bp = selectedBp(); auto sel = getInitialSelection();
return DbgIsDebugging() && !mBps.empty() && (bp.addr != 0 || bp.active); if(!DbgIsDebugging() || mBps.empty() || !isValidIndex(sel, ColType))
return false;
auto & bp = mBps.at(bpIndex(sel));
return bp.addr != 0 || bp.active;
} }
QString bpTypeName(BPXTYPE type) QString bpTypeName(BPXTYPE type)