ClangdClient: Fix possible crash

Fixes: QTCREATORBUG-26018
Change-Id: Ib93d6067950b548f6d437bb06cc9f11a8246e105
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2021-07-19 14:49:08 +02:00
parent 217dfdda7a
commit 42fe70b93e

View File

@@ -787,13 +787,15 @@ ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir)
gatherHelpItemForTooltip(response, uri);
});
connect(this, &Client::workDone, this, [this, project](const ProgressToken &token) {
connect(this, &Client::workDone, this,
[this, p = QPointer(project)](const ProgressToken &token) {
const QString * const val = Utils::get_if<QString>(&token);
if (val && *val == indexingToken()) {
d->isFullyIndexed = true;
emit indexingFinished();
#ifdef WITH_TESTS
emit project->indexingFinished("Indexer.Clangd");
if (p)
emit p->indexingFinished("Indexer.Clangd");
#endif
}
});