CompilationDbProjectManager: Sanitize project parsing

The parsing code used to access all kinds of stuff (e.g. the project
tree and the toolchain manager) from the non-UI thread, which is not
allowed.

Fixes: QTCREATORBUG-22420
Change-Id: I4be47919d7e543376d31826dd380f66f4e060458
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Christian Kandeler
2019-05-16 15:36:55 +02:00
parent 975173af11
commit 0ffbe6a9e4
9 changed files with 385 additions and 181 deletions

View File

@@ -28,7 +28,9 @@
#include "compilationdatabaseconstants.h"
#include <cpptools/cppprojectfile.h>
#include <utils/fileutils.h>
#include <QHash>
#include <QStringList>
namespace ProjectExplorer {
@@ -37,6 +39,23 @@ class Macro;
}
namespace CompilationDatabaseProjectManager {
namespace Internal {
class DbEntry {
public:
QStringList flags;
Utils::FileName fileName;
QString workingDir;
};
class DbContents {
public:
std::vector<DbEntry> entries;
QString extraFileName;
QStringList extras;
};
using MimeBinaryCache = QHash<QString, bool>;
QStringList filterFromFileName(const QStringList &flags, QString baseName);
@@ -50,4 +69,5 @@ void filteredFlags(const QString &fileName,
QStringList splitCommandLine(QString commandLine, QSet<QString> &flagsCache);
} // namespace Internal
} // namespace CompilationDatabaseProjectManager