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::progress, this, &InstanceStaging::setProgress);
|
||||||
connect(child, &Task::stepProgress, this, &InstanceStaging::propagateStepProgress);
|
connect(child, &Task::stepProgress, this, &InstanceStaging::propagateStepProgress);
|
||||||
connect(&m_backoffTimer, &QTimer::timeout, this, &InstanceStaging::childSucceeded);
|
connect(&m_backoffTimer, &QTimer::timeout, this, &InstanceStaging::childSucceeded);
|
||||||
|
m_backoffTimer.setSingleShot(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~InstanceStaging() {}
|
virtual ~InstanceStaging() {}
|
||||||
|
|
@ -959,13 +960,17 @@ class InstanceStaging : public Task {
|
||||||
private slots:
|
private slots:
|
||||||
void childSucceeded()
|
void childSucceeded()
|
||||||
{
|
{
|
||||||
|
if (!isRunning())
|
||||||
|
return;
|
||||||
unsigned sleepTime = backoff();
|
unsigned sleepTime = backoff();
|
||||||
if (m_parent->commitStagedInstance(m_stagingPath, *m_child.get(), m_child->group(), *m_child.get())) {
|
if (m_parent->commitStagedInstance(m_stagingPath, *m_child.get(), m_child->group(), *m_child.get())) {
|
||||||
|
m_backoffTimer.stop();
|
||||||
emitSucceeded();
|
emitSucceeded();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// we actually failed, retry?
|
// we actually failed, retry?
|
||||||
if (sleepTime == maxBackoff) {
|
if (sleepTime == maxBackoff) {
|
||||||
|
m_backoffTimer.stop();
|
||||||
emitFailed(tr("Failed to commit instance, even after multiple retries. It is being blocked by something."));
|
emitFailed(tr("Failed to commit instance, even after multiple retries. It is being blocked by something."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -974,12 +979,14 @@ class InstanceStaging : public Task {
|
||||||
}
|
}
|
||||||
void childFailed(const QString& reason)
|
void childFailed(const QString& reason)
|
||||||
{
|
{
|
||||||
|
m_backoffTimer.stop();
|
||||||
m_parent->destroyStagingPath(m_stagingPath);
|
m_parent->destroyStagingPath(m_stagingPath);
|
||||||
emitFailed(reason);
|
emitFailed(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
void childAborted()
|
void childAborted()
|
||||||
{
|
{
|
||||||
|
m_backoffTimer.stop();
|
||||||
m_parent->destroyStagingPath(m_stagingPath);
|
m_parent->destroyStagingPath(m_stagingPath);
|
||||||
emitAborted();
|
emitAborted();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue