summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2020-11-18 02:14:51 +0100
committerGitHub <noreply@github.com>2020-11-18 02:14:51 +0100
commit31d7be521caeae61eeadc687370817812fe32032 (patch)
treee0e02267db0a29015a816e1479eb5c0054c9b240 /Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp
parent033988980661eebc7e3c3dccfcf7331aa5ed25dd (diff)
parentee13e6ec80f4652274156867d8d44737f80f59ba (diff)
Merge pull request #7714 from cristian64/avoid_leaking_gamelistmodel
DolphinQt: Avoid leaking the GameListModel instance to gracefully shutdown the GameTracker and prevent a crash on exit
Diffstat (limited to 'Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp')
-rw-r--r--Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp b/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp
index adcfa3faf3..521ec48745 100644
--- a/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp
+++ b/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp
@@ -21,7 +21,6 @@
#include "Core/Config/NetplaySettings.h"
#include "Core/NetPlayProto.h"
-#include "DolphinQt/GameList/GameListModel.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/UTF8CodePointCountValidator.h"
#include "DolphinQt/Settings.h"
@@ -29,8 +28,8 @@
#include "UICommon/GameFile.h"
#include "UICommon/NetPlayIndex.h"
-NetPlaySetupDialog::NetPlaySetupDialog(QWidget* parent)
- : QDialog(parent), m_game_list_model(Settings::Instance().GetGameListModel())
+NetPlaySetupDialog::NetPlaySetupDialog(const GameListModel& game_list_model, QWidget* parent)
+ : QDialog(parent), m_game_list_model(game_list_model)
{
setWindowTitle(tr("NetPlay Setup"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
@@ -359,12 +358,12 @@ void NetPlaySetupDialog::PopulateGameList()
QSignalBlocker blocker(m_host_games);
m_host_games->clear();
- for (int i = 0; i < m_game_list_model->rowCount(QModelIndex()); i++)
+ for (int i = 0; i < m_game_list_model.rowCount(QModelIndex()); i++)
{
- std::shared_ptr<const UICommon::GameFile> game = m_game_list_model->GetGameFile(i);
+ std::shared_ptr<const UICommon::GameFile> game = m_game_list_model.GetGameFile(i);
auto* item =
- new QListWidgetItem(QString::fromStdString(m_game_list_model->GetNetPlayName(*game)));
+ new QListWidgetItem(QString::fromStdString(m_game_list_model.GetNetPlayName(*game)));
item->setData(Qt::UserRole, QVariant::fromValue(std::move(game)));
m_host_games->addItem(item);
}