Client: make sure to reset project for client

Change-Id: I23860ee07c4f5793ce3247f46e8d925eae2b2bea
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2021-11-10 12:26:12 +01:00
parent 335f85c525
commit d2ff57309b

View File

@@ -952,7 +952,18 @@ ProjectExplorer::Project *Client::project() const
void Client::setCurrentProject(ProjectExplorer::Project *project)
{
if (m_project == project)
return;
if (m_project)
m_project->disconnect(this);
m_project = project;
if (m_project) {
connect(m_project, &ProjectExplorer::Project::destroyed, this, [this]() {
// the project of the client should already be null since we expect the session and
// the language client manager to reset it before it gets deleted.
QTC_ASSERT(m_project == nullptr, projectClosed(m_project));
});
}
}
void Client::projectOpened(ProjectExplorer::Project *project)