GH-1929 do not allow non-current update task to affect the update process
Errors are handled by setting a flag and failing on the next call to next()
This commit is contained in:
parent
c19f6d4dcd
commit
bea1b5de5e
@ -109,6 +109,11 @@ void OneSixUpdate::next()
|
|||||||
emitFailed(tr("Aborted by user."));
|
emitFailed(tr("Aborted by user."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(m_failed_out_of_order)
|
||||||
|
{
|
||||||
|
emitFailed(m_fail_reason);
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_currentTask ++;
|
m_currentTask ++;
|
||||||
if(m_currentTask > 0)
|
if(m_currentTask > 0)
|
||||||
{
|
{
|
||||||
@ -127,6 +132,7 @@ void OneSixUpdate::next()
|
|||||||
// if the task is already finished by the time we look at it, skip it
|
// if the task is already finished by the time we look at it, skip it
|
||||||
if(task->isFinished())
|
if(task->isFinished())
|
||||||
{
|
{
|
||||||
|
qCritical() << "OneSixUpdate: Skipping finished subtask" << m_currentTask << ":" << task.get();
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
connect(task.get(), &Task::succeeded, this, &OneSixUpdate::subtaskSucceeded);
|
connect(task.get(), &Task::succeeded, this, &OneSixUpdate::subtaskSucceeded);
|
||||||
@ -147,6 +153,13 @@ void OneSixUpdate::subtaskSucceeded()
|
|||||||
qCritical() << "OneSixUpdate: Subtask" << sender() << "succeeded, but work was already done!";
|
qCritical() << "OneSixUpdate: Subtask" << sender() << "succeeded, but work was already done!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
auto senderTask = QObject::sender();
|
||||||
|
auto currentTask = m_tasks[m_currentTask].get();
|
||||||
|
if(senderTask != currentTask)
|
||||||
|
{
|
||||||
|
qDebug() << "OneSixUpdate: Subtask" << sender() << "succeeded out of order.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,6 +170,15 @@ void OneSixUpdate::subtaskFailed(QString error)
|
|||||||
qCritical() << "OneSixUpdate: Subtask" << sender() << "failed, but work was already done!";
|
qCritical() << "OneSixUpdate: Subtask" << sender() << "failed, but work was already done!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
auto senderTask = QObject::sender();
|
||||||
|
auto currentTask = m_tasks[m_currentTask].get();
|
||||||
|
if(senderTask != currentTask)
|
||||||
|
{
|
||||||
|
qDebug() << "OneSixUpdate: Subtask" << sender() << "failed out of order.";
|
||||||
|
m_failed_out_of_order = true;
|
||||||
|
m_fail_reason = error;
|
||||||
|
return;
|
||||||
|
}
|
||||||
emitFailed(error);
|
emitFailed(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,4 +50,6 @@ private:
|
|||||||
QString m_preFailure;
|
QString m_preFailure;
|
||||||
int m_currentTask = -1;
|
int m_currentTask = -1;
|
||||||
bool m_abort = false;
|
bool m_abort = false;
|
||||||
|
bool m_failed_out_of_order = false;
|
||||||
|
QString m_fail_reason;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user