summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordt <qtc-committer@nokia.com>2010-04-22 18:57:43 +0200
committerdt <qtc-committer@nokia.com>2010-04-26 12:29:50 +0200
commitf093d0806b95c9e96962c57d581a2e71e05fcc34 (patch)
tree3387cf05e18c86665801a4949e3ef9c76feff6c1
parentaa3ccee492ed20ff9ec4e5c6e7ea902273d6832f (diff)
downloadqt-creator-f093d0806b95c9e96962c57d581a2e71e05fcc34.tar.gz
Cancel code model indexing on project closing and full code model update
Task-Nr: QTCREATORBUG-1151
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.cpp4
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.h1
-rw-r--r--src/plugins/cpptools/cppmodelmanager.cpp1
-rw-r--r--src/plugins/genericprojectmanager/genericproject.cpp5
-rw-r--r--src/plugins/genericprojectmanager/genericproject.h3
-rw-r--r--src/plugins/qt4projectmanager/qt4project.cpp6
6 files changed, 14 insertions, 6 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index 85f4909138..0f973cd71a 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -85,6 +85,7 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
CMakeProject::~CMakeProject()
{
+ m_codeModelFuture.cancel();
delete m_rootNode;
}
@@ -257,7 +258,8 @@ bool CMakeProject::parseCMakeLists()
pinfo.defines = activeBC->toolChain()->predefinedMacros(); // TODO this is to simplistic
pinfo.frameworkPaths = allFrameworkPaths;
modelmanager->updateProjectInfo(pinfo);
- modelmanager->updateSourceFiles(pinfo.sourceFiles);
+ m_codeModelFuture.cancel();
+ m_codeModelFuture = modelmanager->updateSourceFiles(pinfo.sourceFiles);
}
}
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h
index 7242f92905..ffb3cce73a 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.h
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.h
@@ -132,6 +132,7 @@ private:
bool m_insideFileChanged;
QSet<QString> m_watchedFiles;
CMakeTargetFactory *m_targetFactory;
+ QFuture<void> m_codeModelFuture;
};
class CMakeCbpParser : public QXmlStreamReader
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index 66f8145c27..86a297ef01 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -1209,7 +1209,6 @@ void CppModelManager::onAboutToUnloadSession()
if (m_core->progressManager()) {
m_core->progressManager()->cancelTasks(CppTools::Constants::TASK_INDEX);
}
-
do {
QMutexLocker locker(&mutex);
m_projects.clear();
diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp
index d699c609b2..339a7809e0 100644
--- a/src/plugins/genericprojectmanager/genericproject.cpp
+++ b/src/plugins/genericprojectmanager/genericproject.cpp
@@ -82,6 +82,7 @@ GenericProject::GenericProject(Manager *manager, const QString &fileName)
GenericProject::~GenericProject()
{
+ m_codeModelFuture.cancel();
m_manager->unregisterProject(this);
delete m_rootNode;
@@ -238,6 +239,8 @@ void GenericProject::refresh(RefreshOptions options)
if (options & Configuration) {
filesToUpdate = pinfo.sourceFiles;
filesToUpdate.append(QLatin1String("<configuration>")); // XXX don't hardcode configuration file name
+ // Full update, if there's a code model update, cancel it
+ m_codeModelFuture.cancel();
} else if (options & Files) {
// Only update files that got added to the list
QSet<QString> newFileList = m_files.toSet();
@@ -246,7 +249,7 @@ void GenericProject::refresh(RefreshOptions options)
}
modelManager->updateProjectInfo(pinfo);
- modelManager->updateSourceFiles(filesToUpdate);
+ m_codeModelFuture = modelManager->updateSourceFiles(filesToUpdate);
}
}
diff --git a/src/plugins/genericprojectmanager/genericproject.h b/src/plugins/genericprojectmanager/genericproject.h
index 884d7a10f8..8e7b0bd02b 100644
--- a/src/plugins/genericprojectmanager/genericproject.h
+++ b/src/plugins/genericprojectmanager/genericproject.h
@@ -41,7 +41,7 @@
#include <projectexplorer/toolchain.h>
#include <projectexplorer/buildconfiguration.h>
#include <coreplugin/ifile.h>
-
+#include <QFuture>
#include <QtGui/QLineEdit>
namespace Utils {
@@ -140,6 +140,7 @@ private:
GenericProjectNode *m_rootNode;
ProjectExplorer::ToolChain *m_toolChain;
ProjectExplorer::ToolChain::ToolChainType m_toolChainType;
+ QFuture<void> m_codeModelFuture;
};
class GenericProjectFile : public Core::IFile
diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp
index d4846cadf1..e72aca8912 100644
--- a/src/plugins/qt4projectmanager/qt4project.cpp
+++ b/src/plugins/qt4projectmanager/qt4project.cpp
@@ -257,6 +257,7 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) :
Qt4Project::~Qt4Project()
{
+ m_codeModelFuture.cancel();
m_asyncUpdateState = ShuttingDown;
m_manager->unregisterProject(this);
delete m_projectFiles;
@@ -413,8 +414,6 @@ void Qt4Project::updateCodeModel()
if (debug)
qDebug()<<"Qt4Project::updateCodeModel()";
- m_codeModelFuture.cancel();
-
if (!activeTarget() || !activeTarget()->activeBuildConfiguration())
return;
@@ -723,6 +722,9 @@ void Qt4Project::scheduleAsyncUpdate()
m_partialEvaluate.clear();
m_asyncUpdateState = AsyncFullUpdatePending;
m_asyncUpdateTimer.start();
+
+ // Cancel running code model update
+ m_codeModelFuture.cancel();
}