diff --git a/server/src/client/command_handler/client.cpp b/server/src/client/command_handler/client.cpp index 3d999bd..f5d88ba 100644 --- a/server/src/client/command_handler/client.cpp +++ b/server/src/client/command_handler/client.cpp @@ -272,13 +272,19 @@ command_result ConnectedClient::handleCommandClientMove(Command &cmd) { } for(const auto& oldChannel : channels) { - if(!server_channel_w_lock.owns_lock()) + if(!server_channel_w_lock.owns_lock()) { server_channel_w_lock.lock(); - if(oldChannel->channelType() == ChannelType::temporary && oldChannel->properties()[property::CHANNEL_DELETE_DELAY].as() == 0) - if(this->server->getClientsByChannelRoot(oldChannel, false).empty()) + } + + if(oldChannel->channelType() == ChannelType::temporary && oldChannel->properties()[property::CHANNEL_DELETE_DELAY].as() == 0) { + if(this->server->getClientsByChannelRoot(oldChannel, false).empty()) { this->server->delete_channel(dynamic_pointer_cast(oldChannel), this->ref(), "temporary auto delete", server_channel_w_lock, true); - if(server_channel_w_lock.owns_lock()) + } + } + + if(server_channel_w_lock.owns_lock()) { server_channel_w_lock.unlock(); + } } return command_result{std::forward(result)}; } @@ -700,11 +706,14 @@ command_result ConnectedClient::handleCommandClientEdit(Command &cmd, const std: new_value ); } - if(update_talk_rights) + if(update_talk_rights) { client->updateTalkRights(client->calculate_permission(permission::i_client_talk_power, client->getChannelId())); + } - if(this->server) + if(this->server) { this->server->notifyClientPropertyUpdates(client, updates); + } + nickname_lock.reset(); return command_result{error::ok}; }