diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2017-12-08 15:09:29 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2017-12-12 10:32:35 +0000 |
commit | 115615fc7ca880aa8e12308df79a0a63548c0d5b (patch) | |
tree | e6b12093b1074ac6e672e9060a4fff56f1e45333 | |
parent | 32377a9ac5f8ba7fad76bdf4d5f3c1fc08fd919a (diff) |
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>
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakenodes.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index 2d0ff67465..5efacbf4c4 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -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 |