summaryrefslogtreecommitdiff
path: root/src/plugins/cmakeprojectmanager
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@theqtcompany.com>2016-02-15 10:48:46 +0100
committerTobias Hunger <tobias.hunger@theqtcompany.com>2016-02-15 11:57:29 +0000
commit6c382e134bc637044151fafebb28930912a899cc (patch)
tree2ce8ead800f54e97b66dc4cf4b6f0fdad0b1790b /src/plugins/cmakeprojectmanager
parent4a1a29d9c5ee3502f5746f26a6e981e27548b4f5 (diff)
downloadqt-creator-6c382e134bc637044151fafebb28930912a899cc.tar.gz
CMake: Handle deletion of builddir better
Change-Id: Ifeb35b14aba05c0e23a027b71f185ba20eed3e55 Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Diffstat (limited to 'src/plugins/cmakeprojectmanager')
-rw-r--r--src/plugins/cmakeprojectmanager/builddirmanager.cpp13
-rw-r--r--src/plugins/cmakeprojectmanager/builddirmanager.h3
2 files changed, 14 insertions, 2 deletions
diff --git a/src/plugins/cmakeprojectmanager/builddirmanager.cpp b/src/plugins/cmakeprojectmanager/builddirmanager.cpp
index 82cd4d36b2..f20156e461 100644
--- a/src/plugins/cmakeprojectmanager/builddirmanager.cpp
+++ b/src/plugins/cmakeprojectmanager/builddirmanager.cpp
@@ -48,7 +48,6 @@
#include <QRegularExpression>
#include <QSet>
#include <QTemporaryDir>
-#include <QTimer>
// --------------------------------------------------------------------
// Helper:
@@ -107,9 +106,13 @@ BuildDirManager::BuildDirManager(const Utils::FileName &sourceDir, const Project
QTC_CHECK(!m_buildDir.isEmpty());
QTC_CHECK(k);
+ m_reparseTimer.setSingleShot(true);
+ m_reparseTimer.setInterval(500);
+ connect(&m_reparseTimer, &QTimer::timeout, this, &BuildDirManager::forceReparse);
+
connect(m_watcher, &QFileSystemWatcher::fileChanged, this, [this]() {
if (!isBusy())
- forceReparse();
+ m_reparseTimer.start();
});
QTimer::singleShot(0, this, &BuildDirManager::parse);
@@ -129,6 +132,12 @@ bool BuildDirManager::isBusy() const
void BuildDirManager::forceReparse()
{
+ if (isBusy()) {
+ m_cmakeProcess->disconnect();
+ m_cmakeProcess->deleteLater();
+ m_cmakeProcess = nullptr;
+ }
+
CMakeTool *tool = CMakeKitInformation::cmakeTool(m_kit);
const QString generator = CMakeGeneratorKitInformation::generator(m_kit);
diff --git a/src/plugins/cmakeprojectmanager/builddirmanager.h b/src/plugins/cmakeprojectmanager/builddirmanager.h
index 8aafa5bfa8..91bc9061ab 100644
--- a/src/plugins/cmakeprojectmanager/builddirmanager.h
+++ b/src/plugins/cmakeprojectmanager/builddirmanager.h
@@ -39,6 +39,7 @@
#include <QFutureInterface>
#include <QObject>
#include <QSet>
+#include <QTimer>
QT_FORWARD_DECLARE_CLASS(QTemporaryDir);
QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher);
@@ -117,6 +118,8 @@ private:
// For error reporting:
ProjectExplorer::IOutputParser *m_parser = nullptr;
QFutureInterface<void> *m_future = nullptr;
+
+ QTimer m_reparseTimer;
};
} // namespace Internal