mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-01 07:15:27 +00:00
Fix inconsistent ComputerModel view of the ComputerManager's state after new PC is added
This commit is contained in:
parent
ecebf75b88
commit
78746824e2
@ -121,13 +121,12 @@ void ComputerModel::handleComputerStateChanged(NvComputer* computer)
|
|||||||
emit dataChanged(createIndex(index, 0), createIndex(index, 0));
|
emit dataChanged(createIndex(index, 0), createIndex(index, 0));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// This is a new PC that will be inserted at the end
|
// This is a new PC which may be inserted at an arbitrary point
|
||||||
beginInsertRows(QModelIndex(), m_Computers.count(), m_Computers.count());
|
// in our computer list (since it comes from CM's QMap). Reload
|
||||||
m_Computers.append(computer);
|
// the whole model state to ensure it stays consistent.
|
||||||
endInsertRows();
|
beginResetModel();
|
||||||
|
m_Computers = m_ComputerManager->getComputers();
|
||||||
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Our view of the world must be in sync with ComputerManager's
|
|
||||||
Q_ASSERT(m_Computers.count() == m_ComputerManager->getComputers().count());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user