aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-06-23 09:13:52 -0700
committerGitHub <noreply@github.com>2023-06-23 09:13:52 -0700
commit046d510134a0061c0a1fa89fda80355c9e2f11ff (patch)
treefcbceeb50d29cde8f5378246aceebea33b60bcc1 /launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp
parent8df5ab8aa7ec32ee3c44e2b57dc9c9f04e093d9d (diff)
parent85bbab0e9284e35b0fec26405537c9160496974f (diff)
downloadPrismLauncher-046d510134a0061c0a1fa89fda80355c9e2f11ff.tar.gz
PrismLauncher-046d510134a0061c0a1fa89fda80355c9e2f11ff.tar.bz2
PrismLauncher-046d510134a0061c0a1fa89fda80355c9e2f11ff.zip
Merge pull request #1200 from Trial97/net_job_crash
Made ByteSynkArray to use shared_ptr
Diffstat (limited to 'launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp')
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp
index 0bb11d83..c71dd903 100644
--- a/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp
+++ b/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp
@@ -123,7 +123,7 @@ void ModrinthPage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
qDebug() << "Loading modrinth modpack information";
auto netJob = new NetJob(QString("Modrinth::PackInformation(%1)").arg(current.name), APPLICATION->network());
- auto response = new QByteArray();
+ auto response = std::make_shared<QByteArray>();
QString id = current.id;
@@ -162,10 +162,7 @@ void ModrinthPage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
suggestCurrent();
});
- QObject::connect(netJob, &NetJob::finished, this, [response, netJob] {
- netJob->deleteLater();
- delete response;
- });
+ QObject::connect(netJob, &NetJob::finished, this, [response, netJob] { netJob->deleteLater(); });
netJob->start();
} else
updateUI();
@@ -174,7 +171,7 @@ void ModrinthPage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
qDebug() << "Loading modrinth modpack versions";
auto netJob = new NetJob(QString("Modrinth::PackVersions(%1)").arg(current.name), APPLICATION->network());
- auto response = new QByteArray();
+ auto response = std::make_shared<QByteArray>();
QString id = current.id;
@@ -217,10 +214,7 @@ void ModrinthPage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
suggestCurrent();
});
- QObject::connect(netJob, &NetJob::finished, this, [response, netJob] {
- netJob->deleteLater();
- delete response;
- });
+ QObject::connect(netJob, &NetJob::finished, this, [response, netJob] { netJob->deleteLater(); });
netJob->start();
} else {
@@ -260,10 +254,8 @@ void ModrinthPage::updateUI()
text += donates.join(", ");
}
- if (!current.extra.issuesUrl.isEmpty()
- || !current.extra.sourceUrl.isEmpty()
- || !current.extra.wikiUrl.isEmpty()
- || !current.extra.discordUrl.isEmpty()) {
+ if (!current.extra.issuesUrl.isEmpty() || !current.extra.sourceUrl.isEmpty() || !current.extra.wikiUrl.isEmpty() ||
+ !current.extra.discordUrl.isEmpty()) {
text += "<br><br>" + tr("External links:") + "<br>";
}