ClassView: Fix a possible crash on session switch

Don't call SessionManager methods in non-main thread.
It's not safe to call SessionManger::projects() or
any method of Project class in a non-main thread,
as in meantime the Project object may get deleted
or the Project object may change in main thread in
a not thread-safe way.

Instead, prepare the data needed for the parser's
thread before, when scheduling a call in a main thread,
and pass this data in a safe way.

This fixes possible crash in class view, e.g. on session
switch.

Task-number: QTCREATORBUG-25317
Fixes: QTCREATORBUG-25312
Change-Id: I114aae788aec649d1de3b3d3afdd049ed1e9b2c6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2021-03-01 15:01:35 +01:00
parent ced7a2e51f
commit 8fad758f60
4 changed files with 124 additions and 150 deletions

View File

@@ -60,7 +60,6 @@ signals:
void treeDataUpdate(QSharedPointer<QStandardItem> result);
private:
void onProjectListChanged();
void initialize();
inline bool state() const;