ClangCodeModel: Make VirtualFunctionAssistProcessor more safe

Let's not access the object state after emitting
ClangdFollowSymbol::done(), in case the receiver deletes us.
Can happen in test code.

Change-Id: Ia6c691c0f88b16476da1a6be1cedd106d9da2d53
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2023-11-21 11:09:10 +01:00
parent 6ed456ed9e
commit c20129a973

View File

@@ -310,9 +310,10 @@ void ClangdFollowSymbol::VirtualFunctionAssistProcessor::resetData(bool resetFol
if (!m_followSymbol)
return;
m_followSymbol->d->virtualFuncAssistProcessor = nullptr;
if (resetFollowSymbolData)
m_followSymbol->emitDone();
ClangdFollowSymbol * const followSymbol = m_followSymbol;
m_followSymbol = nullptr;
if (resetFollowSymbolData)
followSymbol->emitDone();
}
IAssistProposal *ClangdFollowSymbol::VirtualFunctionAssistProcessor::createProposal(bool final)