diff options
author | flow <flowlnlnln@gmail.com> | 2023-01-24 16:52:09 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2023-01-25 16:57:51 -0300 |
commit | 29f7ea752fd34bdea64a7c7f2c505982ac39ce0d (patch) | |
tree | f3d76dd640ae4f6a241fb0ff4532d938dc1c33bd /launcher/modplatform/technic | |
parent | 5186ad95d3cd66da8c844d9c3c0cd95b8b2f0b94 (diff) | |
download | PrismLauncher-29f7ea752fd34bdea64a7c7f2c505982ac39ce0d.tar.gz PrismLauncher-29f7ea752fd34bdea64a7c7f2c505982ac39ce0d.tar.bz2 PrismLauncher-29f7ea752fd34bdea64a7c7f2c505982ac39ce0d.zip |
refactor: make shared_qobject_ptr ctor explicit
This turns issues like creating two shared ptrs from a single raw ptr
from popping up at runtime, instead making them a compile error.
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/modplatform/technic')
-rw-r--r-- | launcher/modplatform/technic/SingleZipPackInstallTask.cpp | 4 | ||||
-rw-r--r-- | launcher/modplatform/technic/SolderPackInstallTask.cpp | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/launcher/modplatform/technic/SingleZipPackInstallTask.cpp b/launcher/modplatform/technic/SingleZipPackInstallTask.cpp index 6438d9ef..8fd43d21 100644 --- a/launcher/modplatform/technic/SingleZipPackInstallTask.cpp +++ b/launcher/modplatform/technic/SingleZipPackInstallTask.cpp @@ -44,7 +44,7 @@ void Technic::SingleZipPackInstallTask::executeTask() const QString path = m_sourceUrl.host() + '/' + m_sourceUrl.path(); auto entry = APPLICATION->metacache()->resolveEntry("general", path); entry->setStale(true); - m_filesNetJob = new NetJob(tr("Modpack download"), APPLICATION->network()); + m_filesNetJob.reset(new NetJob(tr("Modpack download"), APPLICATION->network())); m_filesNetJob->addNetAction(Net::Download::makeCached(m_sourceUrl, entry)); m_archivePath = entry->getFullPath(); auto job = m_filesNetJob.get(); @@ -130,7 +130,7 @@ void Technic::SingleZipPackInstallTask::extractFinished() } } - shared_qobject_ptr<Technic::TechnicPackProcessor> packProcessor = new Technic::TechnicPackProcessor(); + auto packProcessor = makeShared<Technic::TechnicPackProcessor>(); connect(packProcessor.get(), &Technic::TechnicPackProcessor::succeeded, this, &Technic::SingleZipPackInstallTask::emitSucceeded); connect(packProcessor.get(), &Technic::TechnicPackProcessor::failed, this, &Technic::SingleZipPackInstallTask::emitFailed); packProcessor->run(m_globalSettings, name(), m_instIcon, m_stagingPath, m_minecraftVersion); diff --git a/launcher/modplatform/technic/SolderPackInstallTask.cpp b/launcher/modplatform/technic/SolderPackInstallTask.cpp index 19731b38..77c503f0 100644 --- a/launcher/modplatform/technic/SolderPackInstallTask.cpp +++ b/launcher/modplatform/technic/SolderPackInstallTask.cpp @@ -70,7 +70,7 @@ void Technic::SolderPackInstallTask::executeTask() { setStatus(tr("Resolving modpack files")); - m_filesNetJob = new NetJob(tr("Resolving modpack files"), m_network); + m_filesNetJob.reset(new NetJob(tr("Resolving modpack files"), m_network)); auto sourceUrl = QString("%1/modpack/%2/%3").arg(m_solderUrl.toString(), m_pack, m_version); m_filesNetJob->addNetAction(Net::Download::makeByteArray(sourceUrl, &m_response)); @@ -107,7 +107,7 @@ void Technic::SolderPackInstallTask::fileListSucceeded() if (!build.minecraft.isEmpty()) m_minecraftVersion = build.minecraft; - m_filesNetJob = new NetJob(tr("Downloading modpack"), m_network); + m_filesNetJob.reset(new NetJob(tr("Downloading modpack"), m_network)); int i = 0; for (const auto &mod : build.mods) { @@ -219,7 +219,7 @@ void Technic::SolderPackInstallTask::extractFinished() } } - shared_qobject_ptr<Technic::TechnicPackProcessor> packProcessor = new Technic::TechnicPackProcessor(); + auto packProcessor = makeShared<Technic::TechnicPackProcessor>(); connect(packProcessor.get(), &Technic::TechnicPackProcessor::succeeded, this, &Technic::SolderPackInstallTask::emitSucceeded); connect(packProcessor.get(), &Technic::TechnicPackProcessor::failed, this, &Technic::SolderPackInstallTask::emitFailed); packProcessor->run(m_globalSettings, name(), m_instIcon, m_stagingPath, m_minecraftVersion, true); |