debugger: cache thread list in model

This commit is contained in:
Ziemas 2025-05-21 14:25:38 +02:00 committed by Ty
parent 9e2a73c7a7
commit f7677105ed
2 changed files with 4 additions and 4 deletions

View File

@ -23,13 +23,11 @@ int ThreadModel::columnCount(const QModelIndex&) const
QVariant ThreadModel::data(const QModelIndex& index, int role) const
{
const std::vector<std::unique_ptr<BiosThread>> threads = m_cpu.GetThreadList();
size_t row = static_cast<size_t>(index.row());
if (row >= threads.size())
if (row >= m_threads.size())
return QVariant();
const BiosThread* thread = threads[row].get();
const BiosThread* thread = m_threads[row].get();
if (role == Qt::DisplayRole)
{
@ -128,5 +126,6 @@ QVariant ThreadModel::headerData(int section, Qt::Orientation orientation, int r
void ThreadModel::refreshData()
{
beginResetModel();
m_threads = m_cpu.GetThreadList();
endResetModel();
}

View File

@ -88,4 +88,5 @@ private:
};
DebugInterface& m_cpu;
std::vector<std::unique_ptr<BiosThread>> m_threads;
};