forked from qt-creator/qt-creator
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user