ClassView: Fix a crash when switching sessions

Move a code that operates on QIcon instances out from non-GUI
thread into GUI thread. Instead of storing the QIcon directly
inside ParserTreeItem, store the path to the project. Set the
real icon when we are back on the main thread side.

Rename some fields to start with m_ prefix.

Task-number: QTCREATORBUG-25317
Task-number: QTCREATORBUG-25312
Change-Id: Iaff89c0995045b70c5378a2ff72c5deb74abf89e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Jarek Kobus
2021-02-16 15:48:08 +01:00
parent c87284356c
commit d4fe3fdb15
4 changed files with 65 additions and 84 deletions

View File

@@ -35,7 +35,6 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
@@ -192,8 +191,6 @@ ParserTreeItem::ConstPtr Parser::parse()
ParserTreeItem::Ptr item = addFlatTree(prj);
if (item.isNull())
continue;
// TODO: remove a call to icon
item->setIcon(prj->containerNode()->icon());
projectTrees.insert(inf, item);
}
@@ -234,7 +231,7 @@ ParserTreeItem::Ptr Parser::getParseProjectTree(const QStringList &fileList,
docTrees.append(docTree);
}
ParserTreeItem::Ptr item = ParserTreeItem::mergeTrees(docTrees);
ParserTreeItem::Ptr item = ParserTreeItem::mergeTrees(Utils::FilePath::fromString(projectId), docTrees);
// update the cache
if (!projectId.isEmpty()) {