shared: indexer: Don't dispatch DirScanner if no dirs given

This makes sense in general, however it also avoids a race condition.

The dirscanner may finish before the filescanworkers for the files
run, this then signals the whole indexer has finished.
Этот коммит содержится в:
Albert S. 2022-06-05 20:29:53 +02:00
родитель 52b296ff01
Коммит 0e5abf96c8
1 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -36,10 +36,14 @@ void Indexer::beginIndexing()
this->filePathTargetsQueue.enqueue(path);
}
}
this->dirScanner->setPaths(dirs);
this->dirScanner->setIgnorePatterns(this->ignorePattern);
this->dirScanner->scan();
if(!dirs.empty())
{
this->dirScanner->setPaths(dirs);
this->dirScanner->setIgnorePatterns(this->ignorePattern);
this->dirScanner->scan();
}
this->workerCancellationToken.store(false, std::memory_order_seq_cst);
launchWorker(this->filePathTargetsQueue, this->filePathTargetsQueue.remaining());
@ -68,7 +72,7 @@ IndexResult Indexer::getResult()
void Indexer::dirScanFinished()
{
Logger::info() << "Dir scan finished";
Logger::info() << "Dir scan finished" << Qt::endl;
if(!isRunning())
{
emit finished();