fix: fix segfault when resolving Flame resources
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
54c26b05fa
commit
970e4b020e
@ -12,6 +12,8 @@ bool Flame::FileResolvingTask::abort()
|
|||||||
bool aborted = true;
|
bool aborted = true;
|
||||||
if (m_dljob)
|
if (m_dljob)
|
||||||
aborted &= m_dljob->abort();
|
aborted &= m_dljob->abort();
|
||||||
|
if (m_checkJob)
|
||||||
|
aborted &= m_checkJob->abort();
|
||||||
return aborted ? Task::abort() : false;
|
return aborted ? Task::abort() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +42,7 @@ void Flame::FileResolvingTask::netJobFinished()
|
|||||||
setProgress(1, 3);
|
setProgress(1, 3);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
// job to check modrinth for blocked projects
|
// job to check modrinth for blocked projects
|
||||||
auto job = new NetJob("Modrinth check", m_network);
|
m_checkJob = new NetJob("Modrinth check", m_network);
|
||||||
blockedProjects = QMap<File *,QByteArray *>();
|
blockedProjects = QMap<File *,QByteArray *>();
|
||||||
auto doc = Json::requireDocument(*result);
|
auto doc = Json::requireDocument(*result);
|
||||||
auto array = Json::requireArray(doc.object()["data"]);
|
auto array = Json::requireArray(doc.object()["data"]);
|
||||||
@ -60,19 +62,15 @@ void Flame::FileResolvingTask::netJobFinished()
|
|||||||
out.resolved = true;
|
out.resolved = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
job->addNetAction(dl);
|
m_checkJob->addNetAction(dl);
|
||||||
blockedProjects.insert(&out, output);
|
blockedProjects.insert(&out, output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
connect(job, &NetJob::finished, this,
|
connect(m_checkJob.get(), &NetJob::finished, this, &Flame::FileResolvingTask::modrinthCheckFinished);
|
||||||
[this, &job] {
|
|
||||||
modrinthCheckFinished();
|
|
||||||
job->deleteLater();
|
|
||||||
});
|
|
||||||
|
|
||||||
job->start();
|
m_checkJob->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Flame::FileResolvingTask::modrinthCheckFinished() {
|
void Flame::FileResolvingTask::modrinthCheckFinished() {
|
||||||
|
@ -30,8 +30,9 @@ protected slots:
|
|||||||
private: /* data */
|
private: /* data */
|
||||||
shared_qobject_ptr<QNetworkAccessManager> m_network;
|
shared_qobject_ptr<QNetworkAccessManager> m_network;
|
||||||
Flame::Manifest m_toProcess;
|
Flame::Manifest m_toProcess;
|
||||||
std::shared_ptr<QByteArray> result;
|
std::shared_ptr<QByteArray> result;
|
||||||
NetJob::Ptr m_dljob;
|
NetJob::Ptr m_dljob;
|
||||||
|
NetJob::Ptr m_checkJob;
|
||||||
|
|
||||||
void modrinthCheckFinished();
|
void modrinthCheckFinished();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user