Fix TestSyncEngine::abortAfterFailedMkdir

It could be possible that _firstJob is marked as finished if
aborted before its parent PropagateDirectory was marked as finished,
allowing a posted scheduleNextJob call to schedule the child job
in-between.
This commit is contained in:
Jocelyn Turcotte 2017-02-08 17:31:13 +01:00
parent 1d9e08d109
commit 1cec2ca13d
3 changed files with 2 additions and 3 deletions

View file

@ -662,7 +662,7 @@ void PropagateDirectory::slotSubJobFinished(SyncFileItem::Status status)
bool wasFirstJob = false;
if (subJob == _firstJob.data()) {
wasFirstJob = true;
_firstJob.reset();
_firstJob.take();
} else {
int i = _subJobs.indexOf(subJob);
ASSERT(i >= 0);

View file

@ -227,7 +227,7 @@ public:
private slots:
bool possiblyRunNextJob(PropagatorJob *next) {
if (next->_state == NotYetStarted) {
connect(next, SIGNAL(finished(SyncFileItem::Status)), this, SLOT(slotSubJobFinished(SyncFileItem::Status)), Qt::QueuedConnection);
connect(next, SIGNAL(finished(SyncFileItem::Status)), this, SLOT(slotSubJobFinished(SyncFileItem::Status)));
connect(next, SIGNAL(itemCompleted(const SyncFileItemPtr &)), this, SIGNAL(itemCompleted(const SyncFileItemPtr &)));
connect(next, SIGNAL(progress(const SyncFileItem &,quint64)), this, SIGNAL(progress(const SyncFileItem &,quint64)));
connect(next, SIGNAL(ready()), this, SIGNAL(ready()));

View file

@ -214,7 +214,6 @@ private slots:
}
void abortAfterFailedMkdir() {
QSKIP("Skip for 2.3");
FakeFolder fakeFolder{FileInfo{}};
QSignalSpy finishedSpy(&fakeFolder.syncEngine(), SIGNAL(finished(bool)));
fakeFolder.serverErrorPaths().append("NewFolder");