aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
authortimoreo <timo.oreo34@gmail.com>2022-02-27 13:14:12 +0100
committertimoreo <timo.oreo34@gmail.com>2022-02-27 13:14:12 +0100
commitccc493cb2bd1873152c1cc94d81604d4e80f1225 (patch)
tree9579123b8360d7ed4e3dffd2772a1647c8b8b670 /launcher
parent2745325ae007315694064b158daa65a63abb8ad4 (diff)
downloadPrismLauncher-ccc493cb2bd1873152c1cc94d81604d4e80f1225.tar.gz
PrismLauncher-ccc493cb2bd1873152c1cc94d81604d4e80f1225.tar.bz2
PrismLauncher-ccc493cb2bd1873152c1cc94d81604d4e80f1225.zip
Cleanly free NetJob in flame modpack
Diffstat (limited to 'launcher')
-rw-r--r--launcher/ui/pages/modplatform/flame/FlamePage.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/launcher/ui/pages/modplatform/flame/FlamePage.cpp b/launcher/ui/pages/modplatform/flame/FlamePage.cpp
index c46b98b5..7e6ac2fd 100644
--- a/launcher/ui/pages/modplatform/flame/FlamePage.cpp
+++ b/launcher/ui/pages/modplatform/flame/FlamePage.cpp
@@ -109,10 +109,10 @@ void FlamePage::onSelectionChanged(QModelIndex first, QModelIndex second)
if (current.versionsLoaded == false)
{
qDebug() << "Loading flame modpack versions";
- NetJob *netJob = new NetJob(QString("Flame::PackVersions(%1)").arg(current.name), APPLICATION->network());
- std::shared_ptr<QByteArray> response = std::make_shared<QByteArray>();
+ auto netJob = new NetJob(QString("Flame::PackVersions(%1)").arg(current.name), APPLICATION->network());
+ auto response = new QByteArray();
int addonId = current.addonId;
- netJob->addNetAction(Net::Download::makeByteArray(QString("https://addons-ecs.forgesvc.net/api/v2/addon/%1/files").arg(addonId), response.get()));
+ netJob->addNetAction(Net::Download::makeByteArray(QString("https://addons-ecs.forgesvc.net/api/v2/addon/%1/files").arg(addonId), response));
QObject::connect(netJob, &NetJob::succeeded, this, [this, response, addonId]
{
@@ -143,6 +143,11 @@ void FlamePage::onSelectionChanged(QModelIndex first, QModelIndex second)
suggestCurrent();
});
+ QObject::connect(netJob, &NetJob::finished, this, [response, netJob]
+ {
+ netJob->deleteLater();
+ delete response;
+ });
netJob->start();
}
else