Clang: Fix crash after cancelled completion request

Amends

  commit 755de9f86a
  Editor: delete processor after canceling

Ensure to update the bookkeeping in BackendReceiver on

  CodeAssistantPrivate::cancelCurrentRequest()

as otherwise we run into a use-after-free.

Change-Id: Ic5abdc9d743dc0b76eb050a9e3e00f85d2c5bc96
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2020-05-19 07:44:46 +02:00
parent bd3a356ce9
commit a35832385c
6 changed files with 31 additions and 2 deletions

View File

@@ -35,7 +35,10 @@
#include <QPointer>
#include <QTextDocument>
namespace TextEditor { class TextEditorWidget; }
namespace TextEditor {
class IAssistProcessor;
class TextEditorWidget;
} // namespace TextEditor
namespace ClangCodeModel {
namespace Internal {
@@ -52,6 +55,7 @@ public:
void setAliveHandler(const AliveHandler &handler);
void addExpectedCompletionsMessage(quint64 ticket, ClangCompletionAssistProcessor *processor);
void cancelProcessor(TextEditor::IAssistProcessor *processor);
void deleteProcessorsOfEditorWidget(TextEditor::TextEditorWidget *textEditorWidget);
QFuture<CppTools::CursorInfo>