Clang: fix heap-use-after-free of ClangCompletionAssistProcessor

Do not delete the ClangCompletionAssistProcessor when resetting the
BackendReceiver since the CodeAssist is the owner of the processor. The
processor will be deleted in the async completion handler set in
CodeAssistantPrivate::requestProposal.

Task-number: QTCREATORBUG-24151
Change-Id: I36cdfd6412cc6ed2b2658e8691f9f4217790affc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2020-06-17 06:56:17 +02:00
parent dcf2f16384
commit ca7995590e

View File

@@ -159,10 +159,8 @@ bool BackendReceiver::isExpectingCompletionsMessage() const
void BackendReceiver::reset()
{
// Clean up waiting assist processors
for (ClangCompletionAssistProcessor *processor : m_assistProcessorsTable) {
for (ClangCompletionAssistProcessor *processor : m_assistProcessorsTable)
processor->setAsyncProposalAvailable(nullptr);
delete processor;
}
m_assistProcessorsTable.clear();
// Clean up futures for references; TODO: Remove duplication