forked from qt-creator/qt-creator
qmljstools::LocatorData: improve safety
* check that we create LocatorData in the same thread as the ModelManagerInterface * pass this as connect context, to ensure signal disconnect Change-Id: I5e51af90c521fd8c83a6cfe2d105832f5a02a04f Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -43,6 +43,7 @@ using namespace QmlJS::AST;
|
||||
LocatorData::LocatorData()
|
||||
{
|
||||
ModelManagerInterface *manager = ModelManagerInterface::instance();
|
||||
Q_ASSERT(thread() == manager->thread()); // we do not protect accesses below
|
||||
|
||||
// Force the updating of source file when updating a project (they could be cached, in such
|
||||
// case LocatorData::onDocumentUpdated will not be called.
|
||||
@@ -61,7 +62,9 @@ LocatorData::LocatorData()
|
||||
|
||||
ProjectExplorer::SessionManager *session = ProjectExplorer::SessionManager::instance();
|
||||
if (session)
|
||||
connect(session, &ProjectExplorer::SessionManager::projectRemoved,
|
||||
connect(session,
|
||||
&ProjectExplorer::SessionManager::projectRemoved,
|
||||
this,
|
||||
[this](ProjectExplorer::Project *) { m_entries.clear(); });
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user