mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
Fix InstanceStaging reentry crash during Modrinth pack updates (#4982)
This commit is contained in:
commit
ba325a6012
1 changed files with 7 additions and 0 deletions
|
|
@ -928,6 +928,7 @@ class InstanceStaging : public Task {
|
|||
connect(child, &Task::progress, this, &InstanceStaging::setProgress);
|
||||
connect(child, &Task::stepProgress, this, &InstanceStaging::propagateStepProgress);
|
||||
connect(&m_backoffTimer, &QTimer::timeout, this, &InstanceStaging::childSucceeded);
|
||||
m_backoffTimer.setSingleShot(true);
|
||||
}
|
||||
|
||||
virtual ~InstanceStaging() {}
|
||||
|
|
@ -959,13 +960,17 @@ class InstanceStaging : public Task {
|
|||
private slots:
|
||||
void childSucceeded()
|
||||
{
|
||||
if (!isRunning())
|
||||
return;
|
||||
unsigned sleepTime = backoff();
|
||||
if (m_parent->commitStagedInstance(m_stagingPath, *m_child.get(), m_child->group(), *m_child.get())) {
|
||||
m_backoffTimer.stop();
|
||||
emitSucceeded();
|
||||
return;
|
||||
}
|
||||
// we actually failed, retry?
|
||||
if (sleepTime == maxBackoff) {
|
||||
m_backoffTimer.stop();
|
||||
emitFailed(tr("Failed to commit instance, even after multiple retries. It is being blocked by something."));
|
||||
return;
|
||||
}
|
||||
|
|
@ -974,12 +979,14 @@ class InstanceStaging : public Task {
|
|||
}
|
||||
void childFailed(const QString& reason)
|
||||
{
|
||||
m_backoffTimer.stop();
|
||||
m_parent->destroyStagingPath(m_stagingPath);
|
||||
emitFailed(reason);
|
||||
}
|
||||
|
||||
void childAborted()
|
||||
{
|
||||
m_backoffTimer.stop();
|
||||
m_parent->destroyStagingPath(m_stagingPath);
|
||||
emitAborted();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue