forked from qt-creator/qt-creator
ClangCodeModel: Fix potential crash
... when removing from the list of FollowSymbol operations. The done() callback of ClangdFollowSymbol messes with the list, so call cancel() after removing the corresponding iterator. Change-Id: Ibb72ffa436598692e48119d93d430bb79bcb0f5e Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1011,9 +1011,10 @@ void ClangdClient::followSymbol(TextDocument *document,
|
||||
: ClangdFollowSymbol::Origin::Code;
|
||||
if (origin == ClangdFollowSymbol::Origin::User) {
|
||||
for (auto it = d->followSymbolOps.begin(); it != d->followSymbolOps.end(); ) {
|
||||
if ((*it)->isInteractive()) {
|
||||
(*it)->cancel();
|
||||
ClangdFollowSymbol * const followSymbol = *it;
|
||||
if (followSymbol->isInteractive()) {
|
||||
it = d->followSymbolOps.erase(it);
|
||||
followSymbol->cancel();
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
|
Reference in New Issue
Block a user