Commit 919f26a4 authored by Nikolai Kosjar's avatar Nikolai Kosjar

Todo: Fix thread safety issue in CppTodoItemScanner

Replace the not thread safe Project::files() with the thread safe
CppModelManager::projectPart() to find out whether a file belongs to a
project or not.

Task-number: QTCREATORBUG-12556
Change-Id: Icf443b5b31c818fc15738aa365562db12439d8d7
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@digia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent b552cfba
......@@ -45,17 +45,6 @@ CppTodoItemsScanner::CppTodoItemsScanner(const KeywordList &keywordList, QObject
SLOT(documentUpdated(CPlusPlus::Document::Ptr)), Qt::DirectConnection);
}
bool CppTodoItemsScanner::shouldProcessFile(const QString &fileName)
{
CppTools::CppModelManagerInterface *modelManager = CppTools::CppModelManagerInterface::instance();
foreach (const CppTools::CppModelManagerInterface::ProjectInfo &info, modelManager->projectInfos())
if (info.project().data()->files(ProjectExplorer::Project::ExcludeGeneratedFiles).contains(fileName))
return true;
return false;
}
void CppTodoItemsScanner::keywordListChanged()
{
// We need to rescan everything known to the code model
......@@ -72,7 +61,8 @@ void CppTodoItemsScanner::keywordListChanged()
void CppTodoItemsScanner::documentUpdated(CPlusPlus::Document::Ptr doc)
{
if (shouldProcessFile(doc->fileName()))
CppTools::CppModelManagerInterface *modelManager = CppTools::CppModelManagerInterface::instance();
if (!modelManager->projectPart(doc->fileName()).isEmpty())
processDocument(doc);
}
......
......@@ -46,7 +46,6 @@ public:
explicit CppTodoItemsScanner(const KeywordList &keywordList, QObject *parent = 0);
protected:
bool shouldProcessFile(const QString &fileName);
void keywordListChanged();
private slots:
......
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