forked from qt-creator/qt-creator
AutoTest: Avoid dead-lock of file system watcher
Calling addPath() on the watcher could dead-lock on some operating systems as we were in an asynchronous process. Avoid calling addPath() from inside an asynchronous process and perform this call from synchronous context. Change-Id: I94cd401e12ccbb3526b8cc4232a9cff7ed552bbb Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -29,6 +29,8 @@
|
||||
|
||||
#include <qmljs/qmljsdocument.h>
|
||||
|
||||
#include <QFileSystemWatcher>
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
@@ -39,8 +41,9 @@ public:
|
||||
TestTreeItem *createTestTreeItem() const override;
|
||||
};
|
||||
|
||||
class QuickTestParser : public CppParser
|
||||
class QuickTestParser : public QObject, public CppParser
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QuickTestParser();
|
||||
virtual ~QuickTestParser();
|
||||
@@ -48,9 +51,15 @@ public:
|
||||
void release() override;
|
||||
bool processDocument(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||
const QString &fileName) override;
|
||||
signals:
|
||||
void updateWatchPaths(const QStringList &directories) const;
|
||||
private:
|
||||
bool handleQtQuickTest(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||
CPlusPlus::Document::Ptr document, const Core::Id &id) const;
|
||||
QList<QmlJS::Document::Ptr> scanDirectoryForQuickTestQmlFiles(const QString &srcDir) const;
|
||||
QmlJS::Snapshot m_qmlSnapshot;
|
||||
QHash<QString, QString> m_proFilesForQmlFiles;
|
||||
QFileSystemWatcher m_directoryWatcher;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user