| 498 | } |
| 499 | |
| 500 | bool BreakpointModel::insertBreakpointRows(int row, int count, std::vector<BreakpointMemcheck> breakpoints, const QModelIndex& index) |
| 501 | { |
| 502 | if (breakpoints.size() != static_cast<size_t>(count)) |
| 503 | return false; |
| 504 | |
| 505 | beginInsertRows(index, row, row + (count - 1)); |
| 506 | |
| 507 | // After endInsertRows, Qt will try and validate our new rows |
| 508 | // Because we add the breakpoints off of the UI thread, our new rows may not be visible yet |
| 509 | // To prevent the (seemingly harmless?) warning emitted by enderInsertRows, add the breakpoints manually here as well |
| 510 | m_breakpoints.insert(m_breakpoints.begin(), breakpoints.begin(), breakpoints.end()); |
| 511 | for (const auto& bp_mc : breakpoints) |
| 512 | { |
| 513 | if (const auto* bp = std::get_if<BreakPoint>(&bp_mc)) |
| 514 | { |
| 515 | Host::RunOnCPUThread([cpu = m_cpu.getCpuType(), bp = *bp] { |
| 516 | CBreakPoints::AddBreakPoint(cpu, bp.addr, false, bp.enabled); |
| 517 | CBreakPoints::ChangeBreakPointDescription(cpu, bp.addr, bp.description); |
| 518 | if (bp.hasCond) |
| 519 | { |
| 520 | CBreakPoints::ChangeBreakPointAddCond(cpu, bp.addr, bp.cond); |
| 521 | } |
| 522 | }); |
| 523 | } |
| 524 | else if (const auto* mc = std::get_if<MemCheck>(&bp_mc)) |
| 525 | { |
| 526 | Host::RunOnCPUThread([cpu = m_cpu.getCpuType(), mc = *mc] { |
| 527 | CBreakPoints::AddMemCheck(cpu, mc.start, mc.end, mc.memCond, mc.result); |
| 528 | CBreakPoints::ChangeMemCheckDescription(cpu, mc.start, mc.end, mc.description); |
| 529 | if (mc.hasCond) |
| 530 | { |
| 531 | CBreakPoints::ChangeMemCheckAddCond(cpu, mc.start, mc.end, mc.cond); |
| 532 | } |
| 533 | }); |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | endInsertRows(); |
| 538 | return true; |
| 539 | } |
| 540 | |
| 541 | void BreakpointModel::refreshData() |
| 542 | { |