fix segfault that happens when account tab is closed (#5474)

This commit is contained in:
RickyRister 2025-01-14 22:10:03 -08:00 committed by GitHub
parent d09b9eb533
commit 23bd18a04c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 332 additions and 121 deletions

View file

@ -2,6 +2,7 @@
#include "../client/tabs/tab_account.h"
#include "../client/ui/pixel_map_generator.h"
#include "../server/user/user_list_manager.h"
#include "../server/user/user_list_widget.h"
#include "../settings/cache_settings.h"
#include "pb/serverinfo_game.pb.h"
@ -284,9 +285,8 @@ void GamesModel::updateGameList(const ServerInfo_Game &game)
endInsertRows();
}
GamesProxyModel::GamesProxyModel(QObject *parent, const TabSupervisor *_tabSupervisor)
: QSortFilterProxyModel(parent), ownUserIsRegistered(_tabSupervisor->isOwnUserRegistered()),
tabSupervisor(_tabSupervisor)
GamesProxyModel::GamesProxyModel(QObject *parent, const UserlistProxy *_userListProxy)
: QSortFilterProxyModel(parent), userListProxy(_userListProxy)
{
resetFilterParameters();
setSortRole(GamesModel::SORT_ROLE);
@ -508,15 +508,14 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow) const
if (!showBuddiesOnlyGames && game.only_buddies()) {
return false;
}
if (hideIgnoredUserGames && tabSupervisor->getTabAccount()->getIgnoreList()->getUsers().contains(
QString::fromStdString(game.creator_info().name()))) {
if (hideIgnoredUserGames && userListProxy->isUserIgnored(QString::fromStdString(game.creator_info().name()))) {
return false;
}
if (!showFullGames && game.player_count() == game.max_players())
return false;
if (!showGamesThatStarted && game.started())
return false;
if (!ownUserIsRegistered)
if (!userListProxy->isOwnUserRegistered())
if (game.only_registered())
return false;
if (!showPasswordProtectedGames && game.with_password())