CompilationDatabaseProjectManager: Fix cached state being unhandled

In this code, database file is being hashed and if hash stays the same,
parser quickly returns ParseResult::Cached. But as database never gets
read, source tree isn't being built, thus dbContents() never gets called

I moved ParseGuard::markAsSuccess() call to the finish() method of parser,
so we tell ProjectExplorer that parsing finished successfully on Cached state

Change-Id: I7ea28017e653ac6e2d7f50047c09a6eb7ecda13f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Alibek Omarov
2022-07-18 08:13:38 +03:00
parent 2f7b86dab3
commit 5b72ecbff7
2 changed files with 3 additions and 1 deletions

View File

@@ -153,6 +153,9 @@ void CompilationDbParser::parserJobFinished()
void CompilationDbParser::finish(ParseResult result)
{
if (result != ParseResult::Failure)
m_guard.markAsSuccess();
emit finished(result);
deleteLater();
}

View File

@@ -69,7 +69,6 @@ public:
QList<ProjectExplorer::FileNode *> scannedFiles() const;
DbContents dbContents() const
{
m_guard.markAsSuccess();
return m_dbContents;
}