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>
This commit is contained in:
@ -24,7 +24,7 @@ void AssetUpdateTask::executeTask()
|
||||
auto assets = profile->getMinecraftAssets();
|
||||
QUrl indexUrl = assets->url;
|
||||
QString localPath = assets->id + ".json";
|
||||
auto job = new NetJob(
|
||||
auto job = makeShared<NetJob>(
|
||||
tr("Asset index for %1").arg(m_inst->name()),
|
||||
APPLICATION->network()
|
||||
);
|
||||
|
@ -61,7 +61,7 @@ void FMLLibrariesTask::executeTask()
|
||||
|
||||
// download missing libs to our place
|
||||
setStatus(tr("Downloading FML libraries..."));
|
||||
auto dljob = new NetJob("FML libraries", APPLICATION->network());
|
||||
NetJob::Ptr dljob{ new NetJob("FML libraries", APPLICATION->network()) };
|
||||
auto metacache = APPLICATION->metacache();
|
||||
Net::Download::Options options = Net::Download::Option::MakeEternal;
|
||||
for (auto &lib : fmlLibsToProcess)
|
||||
@ -71,10 +71,10 @@ void FMLLibrariesTask::executeTask()
|
||||
dljob->addNetAction(Net::Download::makeCached(QUrl(urlString), entry, options));
|
||||
}
|
||||
|
||||
connect(dljob, &NetJob::succeeded, this, &FMLLibrariesTask::fmllibsFinished);
|
||||
connect(dljob, &NetJob::failed, this, &FMLLibrariesTask::fmllibsFailed);
|
||||
connect(dljob, &NetJob::aborted, this, [this]{ emitFailed(tr("Aborted")); });
|
||||
connect(dljob, &NetJob::progress, this, &FMLLibrariesTask::progress);
|
||||
connect(dljob.get(), &NetJob::succeeded, this, &FMLLibrariesTask::fmllibsFinished);
|
||||
connect(dljob.get(), &NetJob::failed, this, &FMLLibrariesTask::fmllibsFailed);
|
||||
connect(dljob.get(), &NetJob::aborted, this, [this]{ emitFailed(tr("Aborted")); });
|
||||
connect(dljob.get(), &NetJob::progress, this, &FMLLibrariesTask::progress);
|
||||
downloadJob.reset(dljob);
|
||||
downloadJob->start();
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ void LibrariesTask::executeTask()
|
||||
auto components = inst->getPackProfile();
|
||||
auto profile = components->getProfile();
|
||||
|
||||
auto job = new NetJob(tr("Libraries for instance %1").arg(inst->name()), APPLICATION->network());
|
||||
NetJob::Ptr job{ new NetJob(tr("Libraries for instance %1").arg(inst->name()), APPLICATION->network()) };
|
||||
downloadJob.reset(job);
|
||||
|
||||
auto metacache = APPLICATION->metacache();
|
||||
|
Reference in New Issue
Block a user