fix regressions

This commit is contained in:
ebbit1q 2025-09-19 03:20:39 +02:00
parent 14ee73c85a
commit 270b957618
3 changed files with 6 additions and 5 deletions

View file

@ -605,7 +605,8 @@ void Server_AbstractParticipant::setUserInterface(Server_AbstractUserInterface *
void Server_AbstractParticipant::disconnectClient()
{
if (!(userInfo->user_level() & ServerInfo_User::IsRegistered) || spectator) {
bool IsRegistered = userInfo->user_level() & ServerInfo_User::IsRegistered;
if (!IsRegistered || spectator) {
game->removeParticipant(this, Event_Leave::USER_DISCONNECTED);
} else {
setUserInterface(nullptr);

View file

@ -63,7 +63,7 @@ protected:
int playerId;
bool spectator;
bool judge;
void getPlayerProperties(ServerInfo_PlayerProperties &result);
virtual void getPlayerProperties(ServerInfo_PlayerProperties &result);
mutable QMutex playerMutex;
public:

View file

@ -73,14 +73,14 @@ void Server_ProtocolHandler::prepareDestroy()
continue;
}
game->gameMutex.lock();
Server_Player *p = game->getPlayer(gameIterator.value().second);
if (!p) {
auto *participant = game->getParticipants().value(gameIterator.value().second);
if (!participant) {
game->gameMutex.unlock();
room->gamesLock.unlock();
continue;
}
p->disconnectClient();
participant->disconnectClient();
game->gameMutex.unlock();
room->gamesLock.unlock();