mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-28 00:42:19 -07:00
Don't manipulate live list
Took 11 minutes
This commit is contained in:
parent
d458ef7efa
commit
cb8fe8305e
1 changed files with 8 additions and 2 deletions
|
|
@ -459,8 +459,14 @@ void GameScene::resizeColumnsAndPlayers(const QList<qreal> &minWidthByColumn, qr
|
||||||
qreal extraWidthPerColumn = (newWidth - minWidth) / playersByColumn.size();
|
qreal extraWidthPerColumn = (newWidth - minWidth) / playersByColumn.size();
|
||||||
qreal newx = phasesToolbar->getWidth();
|
qreal newx = phasesToolbar->getWidth();
|
||||||
|
|
||||||
for (int col = 0; col < playersByColumn.size(); ++col) {
|
// Snapshot the columns: resizing a player's table can synchronously trigger
|
||||||
for (PlayerGraphicsItem *player : playersByColumn[col]) {
|
// GameScene::rearrange (table width -> sizeChanged -> updateBoundingRect ->
|
||||||
|
// sizeChanged -> rearrange), and rearrange rebuilds playersByColumn. Iterating
|
||||||
|
// the live container across that re-entrant call would use invalidated iterators.
|
||||||
|
const QList<QList<PlayerGraphicsItem *>> columns = playersByColumn;
|
||||||
|
|
||||||
|
for (int col = 0; col < columns.size(); ++col) {
|
||||||
|
for (PlayerGraphicsItem *player : columns[col]) {
|
||||||
player->processSceneSizeChange(minWidthByColumn[col] + extraWidthPerColumn);
|
player->processSceneSizeChange(minWidthByColumn[col] + extraWidthPerColumn);
|
||||||
player->setPos(newx, player->y());
|
player->setPos(newx, player->y());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue