Qt4Project: fix canceling codemodel prevents codemodel update

After a cancel the next codemodel needs to start regardless of whether
the underlying information is still the same.

Change-Id: I24eecaf2b8f5c96904002ca1e3dbe4df0061cc9c
Reviewed-on: http://codereview.qt.nokia.com/216
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
dt_
2011-05-30 13:11:31 +02:00
committed by Daniel Teske
parent 6b0e6072f5
commit 8ea4b9700d
2 changed files with 7 additions and 2 deletions

View File

@@ -263,7 +263,8 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) :
m_asyncUpdateFutureInterface(0), m_asyncUpdateFutureInterface(0),
m_pendingEvaluateFuturesCount(0), m_pendingEvaluateFuturesCount(0),
m_asyncUpdateState(NoState), m_asyncUpdateState(NoState),
m_cancelEvaluate(false) m_cancelEvaluate(false),
m_codeModelCanceled(false)
{ {
setProjectContext(Core::Context(Qt4ProjectManager::Constants::PROJECT_ID)); setProjectContext(Core::Context(Qt4ProjectManager::Constants::PROJECT_ID));
setProjectLanguage(Core::Context(ProjectExplorer::Constants::LANG_CXX)); setProjectLanguage(Core::Context(ProjectExplorer::Constants::LANG_CXX));
@@ -513,7 +514,8 @@ void Qt4Project::updateCppCodeModel()
&& pinfo.includePaths == allIncludePaths && pinfo.includePaths == allIncludePaths
&& pinfo.frameworkPaths == allFrameworkPaths && pinfo.frameworkPaths == allFrameworkPaths
&& fileList && fileList
&& pinfo.precompiledHeaders == allPrecompileHeaders) { && pinfo.precompiledHeaders == allPrecompileHeaders
&& !m_codeModelCanceled) {
// Nothing to update... // Nothing to update...
} else { } else {
pinfo.sourceFiles.clear(); pinfo.sourceFiles.clear();
@@ -534,6 +536,7 @@ void Qt4Project::updateCppCodeModel()
modelmanager->updateProjectInfo(pinfo); modelmanager->updateProjectInfo(pinfo);
m_codeModelFuture = modelmanager->updateSourceFiles(pinfo.sourceFiles); m_codeModelFuture = modelmanager->updateSourceFiles(pinfo.sourceFiles);
m_codeModelCanceled = false;
} }
} }
@@ -687,6 +690,7 @@ void Qt4Project::scheduleAsyncUpdate()
// Cancel running code model update // Cancel running code model update
m_codeModelFuture.cancel(); m_codeModelFuture.cancel();
m_codeModelCanceled = true;
} }

View File

@@ -250,6 +250,7 @@ private:
enum AsyncUpdateState { NoState, Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown }; enum AsyncUpdateState { NoState, Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown };
AsyncUpdateState m_asyncUpdateState; AsyncUpdateState m_asyncUpdateState;
bool m_cancelEvaluate; bool m_cancelEvaluate;
bool m_codeModelCanceled;
QList<Qt4ProFileNode *> m_partialEvaluate; QList<Qt4ProFileNode *> m_partialEvaluate;
QFuture<void> m_codeModelFuture; QFuture<void> m_codeModelFuture;