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.
Cette révision appartient à :
Albert S. 2022-06-05 20:29:53 +02:00
Parent 52b296ff01
révision 0e5abf96c8

Voir le fichier

@ -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();