Qmake: Do not crash when accessing PriFiles from project tree

The project tree is static nowadays, and the QmakePriFileNodes hold
pointers to their corresponding PriFiles. This is fast, but not
entirely safe: The PriFiles are constantly updating as the project
is parsed.

So make sure not to rely on the stored pointer while the project
is parsing and go through Project::rootProFile() in that case.

Once the parsing is done, the project tree has been updated with
new data, that reflects the current QmakePriFile tree.

Task-number: QTCREATORBUG-19428
Change-Id: Ifaa3432cad7774142d562648d93104629736d478
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Tobias Hunger
2017-12-08 15:09:29 +01:00
parent 32377a9ac5
commit 115615fc7c

View File

@@ -53,7 +53,11 @@ QmakePriFileNode::QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmak
QmakePriFile *QmakePriFileNode::priFile() const
{
return m_qmakePriFile;
if (!m_project->isParsing())
return m_qmakePriFile;
// During a parsing run the qmakePriFile tree will change, so search for the PriFile and
// do not depend on the cached value.
return m_project->rootProFile()->findPriFile(filePath());
}
bool QmakePriFileNode::deploysFolder(const QString &folder) const