aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/modplatform/flame
diff options
context:
space:
mode:
authortimoreo22 <timo.oreo34@gmail.com>2022-03-01 16:56:10 +0100
committerGitHub <noreply@github.com>2022-03-01 16:56:10 +0100
commit8bdd2befe961d1c70e89d096f71581dd50a032f9 (patch)
tree596e3a4d4677239cc01b8a42f3bd853b5c724893 /launcher/ui/pages/modplatform/flame
parente1f28be15128175467e8a44e9556223963fb56c1 (diff)
parentccc493cb2bd1873152c1cc94d81604d4e80f1225 (diff)
downloadPrismLauncher-8bdd2befe961d1c70e89d096f71581dd50a032f9.tar.gz
PrismLauncher-8bdd2befe961d1c70e89d096f71581dd50a032f9.tar.bz2
PrismLauncher-8bdd2befe961d1c70e89d096f71581dd50a032f9.zip
Merge pull request #205 from timoreo22/fix-version-select
Fixed wrong version info
Diffstat (limited to 'launcher/ui/pages/modplatform/flame')
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameModPage.cpp5
-rw-r--r--launcher/ui/pages/modplatform/flame/FlamePage.cpp16
2 files changed, 16 insertions, 5 deletions
diff --git a/launcher/ui/pages/modplatform/flame/FlameModPage.cpp b/launcher/ui/pages/modplatform/flame/FlameModPage.cpp
index 6d33a6ac..114ac907 100644
--- a/launcher/ui/pages/modplatform/flame/FlameModPage.cpp
+++ b/launcher/ui/pages/modplatform/flame/FlameModPage.cpp
@@ -118,7 +118,10 @@ void FlameModPage::onSelectionChanged(QModelIndex first, QModelIndex second) {
.arg(addonId),
response));
- QObject::connect(netJob, &NetJob::succeeded, this, [this, response] {
+ QObject::connect(netJob, &NetJob::succeeded, this, [this, response, addonId] {
+ if(addonId != current.addonId){
+ return; //wrong request
+ }
QJsonParseError parse_error;
QJsonDocument doc = QJsonDocument::fromJson(*response, &parse_error);
if (parse_error.error != QJsonParseError::NoError) {
diff --git a/launcher/ui/pages/modplatform/flame/FlamePage.cpp b/launcher/ui/pages/modplatform/flame/FlamePage.cpp
index 1138a298..7e6ac2fd 100644
--- a/launcher/ui/pages/modplatform/flame/FlamePage.cpp
+++ b/launcher/ui/pages/modplatform/flame/FlamePage.cpp
@@ -109,13 +109,16 @@ 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]
+ QObject::connect(netJob, &NetJob::succeeded, this, [this, response, addonId]
{
+ if(addonId != current.addonId){
+ return; //wrong request
+ }
QJsonParseError parse_error;
QJsonDocument doc = QJsonDocument::fromJson(*response, &parse_error);
if(parse_error.error != QJsonParseError::NoError) {
@@ -140,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