diff options
author | timoreo <contact@timoreo.fr> | 2022-09-26 11:50:55 +0200 |
---|---|---|
committer | timoreo <contact@timoreo.fr> | 2022-09-26 11:50:55 +0200 |
commit | dd6f670dec7dfd1a9ad6f4595ad5447ac735c737 (patch) | |
tree | 52afb4b84eb03ec51d36918d4c85daf871bed21c /launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp | |
parent | 9ff364b0d3c12f9138037cce585c03c850721b82 (diff) | |
download | PrismLauncher-dd6f670dec7dfd1a9ad6f4595ad5447ac735c737.tar.gz PrismLauncher-dd6f670dec7dfd1a9ad6f4595ad5447ac735c737.tar.bz2 PrismLauncher-dd6f670dec7dfd1a9ad6f4595ad5447ac735c737.zip |
fix: Fixed memory leak
Signed-off-by: timoreo <contact@timoreo.fr>
Diffstat (limited to 'launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp')
-rw-r--r-- | launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp index f9709551..ddeea224 100644 --- a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp +++ b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp @@ -238,11 +238,12 @@ bool ModrinthCreationTask::createInstance() if (!file.downloads.empty()) { // FIXME: This really needs to be put into a ConcurrentTask of // MultipleOptionsTask's , once those exist :) - connect(dl.get(), &NetAction::failed, [this, &file, path, dl] { - auto dl = Net::Download::makeFile(file.downloads.dequeue(), path); - dl->addValidator(new Net::ChecksumValidator(file.hashAlgorithm, file.hash)); - m_files_job->addNetAction(dl); - dl->succeeded(); + auto param = dl.toWeakRef(); + connect(dl.get(), &NetAction::failed, [this, &file, path, param] { + auto ndl = Net::Download::makeFile(file.downloads.dequeue(), path); + ndl->addValidator(new Net::ChecksumValidator(file.hashAlgorithm, file.hash)); + m_files_job->addNetAction(ndl); + if (auto shared = param.lock()) shared->succeeded(); }); } } |