Commit f093d080 authored by dt's avatar dt
Browse files

Cancel code model indexing on project closing and full code model update

Task-Nr: QTCREATORBUG-1151
parent aa3ccee4
......@@ -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);
}
}
......
......@@ -132,6 +132,7 @@ private:
bool m_insideFileChanged;
QSet<QString> m_watchedFiles;
CMakeTargetFactory *m_targetFactory;
QFuture<void> m_codeModelFuture;
};
class CMakeCbpParser : public QXmlStreamReader
......
......@@ -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();
......
......@@ -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);
}
}
......
......@@ -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
......
......@@ -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();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment