summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer/project.cpp
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2021-10-14 10:27:45 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2021-10-20 12:35:22 +0000
commit2948d282ce6518d1befd3e1d3371089a9863cac8 (patch)
tree8f904fc0991a889047aebf06b1df684384fc4c12 /src/plugins/projectexplorer/project.cpp
parentae0b648a853d5e4687f2f9d71c902856dcb3d42b (diff)
downloadqt-creator-2948d282ce6518d1befd3e1d3371089a9863cac8.tar.gz
Don't call DocumentManager::addDocument() from non-main thread
Detect that constructor of ResourceTopLevelNode is being run from non-main thread and omit creation of ResourceFileWatcher in this case. The construction of ResourceFileWatcher will be postponed until the node tree returns back to the main thread. This happens later inside Project::setRootProjectNode() when ProjectTree::applyTreeManager() is called for the second time - this time it's done from the main thread. In order to setup the lacking resource file watchers we install an additional folder node visitor only in case when the handler is called from main thread. The visitor sets up the lacking resource watchers if that's still needed. Amends: 0bcab32657f1511892eda53194dce259e40edf21 Fixes: QTCREATORBUG-26417 Change-Id: Ia1bfb7f284afb833b6b4291accc4d0a91bd0d6c5 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/project.cpp')
-rw-r--r--src/plugins/projectexplorer/project.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index 620eb61f5f..38cdf16171 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -586,7 +586,8 @@ void Project::setRootProjectNode(std::unique_ptr<ProjectNode> &&root)
}
if (root) {
- ProjectTree::applyTreeManager(root.get());
+ ProjectTree::applyTreeManager(root.get(), ProjectTree::AsyncPhase);
+ ProjectTree::applyTreeManager(root.get(), ProjectTree::FinalPhase);
root->setParentFolderNode(d->m_containerNode.get());
}