Merge pull request #1200 from Trial97/net_job_crash

Made ByteSynkArray to use shared_ptr
This commit is contained in:
Rachel Powers 2023-06-23 09:13:52 -07:00 committed by Sefa Eyeoglu
parent 9df3c5d3c0
commit 05056e1abf
No known key found for this signature in database
GPG key ID: E13DFD4B47127951
47 changed files with 659 additions and 793 deletions

View file

@ -157,7 +157,7 @@ void ModrinthPackExportTask::makeApiRequest()
if (pendingHashes.isEmpty())
buildZip();
else {
QByteArray* response = new QByteArray;
auto response = std::make_shared<QByteArray>();
task = api.currentVersions(pendingHashes.values(), "sha512", response);
connect(task.get(), &NetJob::succeeded, [this, response]() { parseApiResponse(response); });
connect(task.get(), &NetJob::failed, this, &ModrinthPackExportTask::emitFailed);
@ -165,7 +165,7 @@ void ModrinthPackExportTask::makeApiRequest()
}
}
void ModrinthPackExportTask::parseApiResponse(const QByteArray* response)
void ModrinthPackExportTask::parseApiResponse(const std::shared_ptr<QByteArray> response)
{
task = nullptr;