aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2024-02-19 13:42:37 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2024-02-20 12:29:31 +0000
commit042d87a1e11bac17a0be8758a93620e2efdbe3bb (patch)
tree79554f9f7013441b3cd7988807ac3d8cf470d000 /src/plugins/cppeditor
parentb74bb782bbc001839502f879d97e07b4433d4a45 (diff)
CppUseSelectionsUpdater: Don't delete the watcher from its signal handler
Use std::unique_ptr instead, as QScopedPointer doesn't offer release(). Task-number: QTCREATORBUG-30401 Change-Id: If8f922fb52363a2e866cfacf770f617a00aa7fe5 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/plugins/cppeditor')
-rw-r--r--src/plugins/cppeditor/cppuseselectionsupdater.cpp10
-rw-r--r--src/plugins/cppeditor/cppuseselectionsupdater.h2
2 files changed, 5 insertions, 7 deletions
diff --git a/src/plugins/cppeditor/cppuseselectionsupdater.cpp b/src/plugins/cppeditor/cppuseselectionsupdater.cpp
index e03475ea80..3b9fe40a89 100644
--- a/src/plugins/cppeditor/cppuseselectionsupdater.cpp
+++ b/src/plugins/cppeditor/cppuseselectionsupdater.cpp
@@ -3,18 +3,16 @@
#include "cppuseselectionsupdater.h"
-#include "cppeditorwidget.h"
#include "cppeditordocument.h"
+#include "cppeditorwidget.h"
#include "cppmodelmanager.h"
-#include "cpptoolsreuse.h"
+#include <utils/qtcassert.h>
#include <utils/textutils.h>
#include <QTextBlock>
#include <QTextCursor>
-#include <utils/qtcassert.h>
-
enum { updateUseSelectionsInternalInMs = 500 };
namespace CppEditor {
@@ -67,7 +65,7 @@ CppUseSelectionsUpdater::RunnerInfo CppUseSelectionsUpdater::update(CallType cal
m_runnerWatcher->cancel();
m_runnerWatcher.reset(new QFutureWatcher<CursorInfo>);
- connect(m_runnerWatcher.data(), &QFutureWatcherBase::finished,
+ connect(m_runnerWatcher.get(), &QFutureWatcherBase::finished,
this, &CppUseSelectionsUpdater::onFindUsesFinished);
m_runnerRevision = m_editorWidget->document()->revision();
@@ -142,7 +140,7 @@ void CppUseSelectionsUpdater::onFindUsesFinished()
processResults(m_runnerWatcher->result());
- m_runnerWatcher.reset();
+ m_runnerWatcher.release()->deleteLater();
}
CppUseSelectionsUpdater::ExtraSelections
diff --git a/src/plugins/cppeditor/cppuseselectionsupdater.h b/src/plugins/cppeditor/cppuseselectionsupdater.h
index b303ce7c25..88205c8974 100644
--- a/src/plugins/cppeditor/cppuseselectionsupdater.h
+++ b/src/plugins/cppeditor/cppuseselectionsupdater.h
@@ -54,7 +54,7 @@ private:
QTimer m_timer;
- QScopedPointer<QFutureWatcher<CursorInfo>> m_runnerWatcher;
+ std::unique_ptr<QFutureWatcher<CursorInfo>> m_runnerWatcher;
int m_runnerRevision = -1;
int m_runnerWordStartPosition = -1;
bool m_updateSelections = true;