Projects: Create QIcons in the UI thread

Creating QIcons elsewhere is not safe because of image reader plugin
loading and the pixmap cache.

Fixes: QTCREATORBUG-25301
Change-Id: Ia22a0cd571f808d7f5c639353fdf2e548743f8ca
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Eike Ziller
2021-04-08 16:31:31 +02:00
parent f4ab1279fd
commit bce81fd992
9 changed files with 116 additions and 41 deletions

View File

@@ -38,18 +38,15 @@ namespace Internal {
MesonProjectNode::MesonProjectNode(const Utils::FilePath &directory)
: ProjectExplorer::ProjectNode{directory}
{
static const auto MesonIcon = QIcon(Constants::Icons::MESON);
setPriority(Node::DefaultProjectPriority + 1000);
setIcon(MesonIcon);
setIcon(Constants::Icons::MESON);
setListInProject(false);
}
MesonFileNode::MesonFileNode(const Utils::FilePath &file)
: ProjectExplorer::ProjectNode{file}
{
static const auto MesonFolderIcon = Core::FileIconProvider::directoryIcon(
Constants::Icons::MESON);
setIcon(MesonFolderIcon);
setIcon(ProjectExplorer::DirectoryIcon(Constants::Icons::MESON));
setListInProject(true);
}
@@ -58,7 +55,7 @@ MesonTargetNode::MesonTargetNode(const Utils::FilePath &directory, const QString
, m_name{name}
{
setPriority(Node::DefaultProjectPriority + 900);
setIcon(QIcon(":/projectexplorer/images/build.png"));
setIcon(":/projectexplorer/images/build.png");
setListInProject(false);
setShowWhenEmpty(true);
setProductType(ProjectExplorer::ProductType::Other);