ClangdClient: Don't delete an object from its signal handler

Delete it later instead.

Fixes: QTCREATORBUG-27803
Change-Id: I1108a87bc762a7da690b8999c9e73e127d79d3c4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Jarek Kobus
2022-07-06 11:27:55 +02:00
parent 1231c9e546
commit 650bc260c6

View File

@@ -1608,7 +1608,7 @@ void ClangdClient::followSymbol(TextDocument *document,
d->followSymbol = new ClangdFollowSymbol(this, adjustedCursor, editorWidget, document, callback,
openInSplit);
connect(d->followSymbol, &ClangdFollowSymbol::done, this, [this] {
delete d->followSymbol;
d->followSymbol->deleteLater();
d->followSymbol = nullptr;
});
}
@@ -1625,7 +1625,7 @@ void ClangdClient::switchDeclDef(TextDocument *document, const QTextCursor &curs
delete d->switchDeclDef;
d->switchDeclDef = new ClangdSwitchDeclDef(this, document, cursor, editorWidget, callback);
connect(d->switchDeclDef, &ClangdSwitchDeclDef::done, this, [this] {
delete d->switchDeclDef;
d->switchDeclDef->deleteLater();
d->switchDeclDef = nullptr;
});
}