diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-06-03 13:30:22 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-06-05 08:35:14 +0000 |
commit | b14c07eed60b90309b017a0f1f2b2a5de4e1d9e7 (patch) | |
tree | b411c4642d4bd3f545e679e735b0d0b15b242b14 /src/plugins/texteditor/codeassist | |
parent | e376355b189ea0c9b33bbeb606dda403713a0091 (diff) |
TextEditor: Reuse qScopeGuard instead of ExecuteOnDestruction
Change-Id: I2ca7d4676bb4f34fbf59fd45bcd01d7857cb7e4e
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Diffstat (limited to 'src/plugins/texteditor/codeassist')
-rw-r--r-- | src/plugins/texteditor/codeassist/codeassistant.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/texteditor/codeassist/codeassistant.cpp b/src/plugins/texteditor/codeassist/codeassistant.cpp index 430b7252cd..0da6571da8 100644 --- a/src/plugins/texteditor/codeassist/codeassistant.cpp +++ b/src/plugins/texteditor/codeassist/codeassistant.cpp @@ -18,13 +18,13 @@ #include <coreplugin/editormanager/editormanager.h> #include <extensionsystem/pluginmanager.h> #include <utils/algorithm.h> -#include <utils/executeondestruction.h> #include <utils/qtcassert.h> #include <QKeyEvent> #include <QList> #include <QObject> #include <QScopedPointer> +#include <QScopeGuard> #include <QTimer> using namespace TextEditor::Internal; @@ -158,7 +158,7 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason, bool isUpdate) { // make sure to cleanup old proposals if we cannot find a new assistant - Utils::ExecuteOnDestruction earlyReturnContextClear([this] { destroyContext(); }); + auto cleanup = qScopeGuard([this] { destroyContext(); }); if (isWaitingForProposal()) cancelCurrentRequest(); @@ -179,7 +179,7 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason, QTC_ASSERT(assistInterface, return); // We got an assist provider and interface so no need to reset the current context anymore - earlyReturnContextClear.reset({}); + cleanup.dismiss(); m_assistKind = kind; m_requestProvider = provider; |