diff --git a/rpcs3/rpcs3qt/debugger_list.cpp b/rpcs3/rpcs3qt/debugger_list.cpp index a9580101b7..59d4a14936 100644 --- a/rpcs3/rpcs3qt/debugger_list.cpp +++ b/rpcs3/rpcs3qt/debugger_list.cpp @@ -35,7 +35,12 @@ debugger_list::debugger_list(QWidget* parent, std::shared_ptr gui_ void debugger_list::UpdateCPUData(cpu_thread* cpu, CPUDisAsm* disasm) { - m_cpu = cpu; + if (m_cpu != cpu) + { + m_cpu = cpu; + m_selected_instruction = -1; + } + m_disasm = disasm; } @@ -77,6 +82,19 @@ void debugger_list::ShowAddress(u32 addr, bool select_addr, bool force) const auto& default_foreground = palette().color(foregroundRole()); const auto& default_background = palette().color(backgroundRole()); + if (select_addr) + { + m_selected_instruction = addr; + } + + for (uint i = 0; i < m_item_count; ++i) + { + if (auto list_item = item(i); list_item->isSelected()) + { + list_item->setSelected(false); + } + } + if (!m_cpu || !m_disasm || +m_cpu->state + cpu_flag::exit + cpu_flag::wait == +m_cpu->state) { for (uint i = 0; i < m_item_count; ++i) @@ -103,9 +121,13 @@ void debugger_list::ShowAddress(u32 addr, bool select_addr, bool force) list_item->setForeground(m_text_color_pc); list_item->setBackground(m_color_pc); } - else if (select_addr && pc == addr) + else if (pc == m_selected_instruction) { - list_item->setSelected(true); + // setSelected may invoke a resize event which causes stack overflow, terminate recursion + if (!list_item->isSelected()) + { + list_item->setSelected(true); + } } else if (IsBreakpoint(pc)) { diff --git a/rpcs3/rpcs3qt/debugger_list.h b/rpcs3/rpcs3qt/debugger_list.h index 0a53ed653b..ee74f2f654 100644 --- a/rpcs3/rpcs3qt/debugger_list.h +++ b/rpcs3/rpcs3qt/debugger_list.h @@ -20,6 +20,7 @@ public: u32 m_pc = 0; u32 m_item_count = 30; bool m_follow_thread = true; // If true, follow the selected thread to wherever it goes in code + u32 m_selected_instruction = -1; QColor m_color_bp; QColor m_color_pc; QColor m_text_color_bp;