Put mutex around returning cards on concede (#5964)

This commit is contained in:
RickyRister
2025-06-08 19:28:59 -07:00
committed by GitHub
parent 1e0a356cd2
commit 87767be4a6

View File

@@ -920,6 +920,8 @@ Server_Player::cmdConcede(const Command_Concede & /*cmd*/, ResponseContainer & /
game->removeArrowsRelatedToPlayer(ges, this);
game->unattachCards(ges, this);
playerMutex.lock();
// Return cards to their rightful owners before conceding the game
static const QRegularExpression ownerRegex{"Owner: ?([^\n]+)"};
for (const auto &card : zones.value("table")->getCards()) {
@@ -959,6 +961,8 @@ Server_Player::cmdConcede(const Command_Concede & /*cmd*/, ResponseContainer & /
}
}
playerMutex.unlock();
// All borrowed cards have been returned, can now continue cleanup process
clearZones();