aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2024-02-19 13:27:47 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2024-02-19 16:23:47 +0000
commit5e2854e6858d7145de6e2f9cdf2586fbeb139093 (patch)
treec328f72845c5f5d3fd95a6c455efc66c20a5c358 /src/plugins/cppeditor
parent76539a659e9cc10a6019b3f5d3a5851b761e58f5 (diff)
SemanticHighlighter: Don't delete the watcher from its signal handler
Use std::unique_ptr instead, as QScopedPointer doesn't offer release(). Change-Id: I8e885e477d1aeb8ce9462e8fd249a5196424df18 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/cppeditor')
-rw-r--r--src/plugins/cppeditor/semantichighlighter.cpp10
-rw-r--r--src/plugins/cppeditor/semantichighlighter.h4
2 files changed, 7 insertions, 7 deletions
diff --git a/src/plugins/cppeditor/semantichighlighter.cpp b/src/plugins/cppeditor/semantichighlighter.cpp
index fe52bbdebd..4cafaecd46 100644
--- a/src/plugins/cppeditor/semantichighlighter.cpp
+++ b/src/plugins/cppeditor/semantichighlighter.cpp
@@ -232,25 +232,25 @@ void SemanticHighlighter::onHighlighterFinished()
TextDocumentLayout::setParentheses(currentBlock, getClearedParentheses(currentBlock));
}
- m_watcher.reset();
+ m_watcher.release()->deleteLater();
qCDebug(log) << "onHighlighterFinished() took" << t.elapsed() << "ms";
}
void SemanticHighlighter::connectWatcher()
{
using Watcher = QFutureWatcher<HighlightingResult>;
- connect(m_watcher.data(), &Watcher::resultsReadyAt,
+ connect(m_watcher.get(), &Watcher::resultsReadyAt,
this, &SemanticHighlighter::onHighlighterResultAvailable);
- connect(m_watcher.data(), &Watcher::finished,
+ connect(m_watcher.get(), &Watcher::finished,
this, &SemanticHighlighter::onHighlighterFinished);
}
void SemanticHighlighter::disconnectWatcher()
{
using Watcher = QFutureWatcher<HighlightingResult>;
- disconnect(m_watcher.data(), &Watcher::resultsReadyAt,
+ disconnect(m_watcher.get(), &Watcher::resultsReadyAt,
this, &SemanticHighlighter::onHighlighterResultAvailable);
- disconnect(m_watcher.data(), &Watcher::finished,
+ disconnect(m_watcher.get(), &Watcher::finished,
this, &SemanticHighlighter::onHighlighterFinished);
}
diff --git a/src/plugins/cppeditor/semantichighlighter.h b/src/plugins/cppeditor/semantichighlighter.h
index ea49f289a0..a0d8e8db9e 100644
--- a/src/plugins/cppeditor/semantichighlighter.h
+++ b/src/plugins/cppeditor/semantichighlighter.h
@@ -6,11 +6,11 @@
#include "cppeditor_global.h"
#include <QFutureWatcher>
-#include <QScopedPointer>
#include <QTextCharFormat>
#include <QVector>
#include <functional>
+#include <memory>
#include <set>
namespace TextEditor {
@@ -80,7 +80,7 @@ private:
TextEditor::TextDocument *m_baseTextDocument;
unsigned m_revision = 0;
- QScopedPointer<QFutureWatcher<TextEditor::HighlightingResult>> m_watcher;
+ std::unique_ptr<QFutureWatcher<TextEditor::HighlightingResult>> m_watcher;
QHash<int, QTextCharFormat> m_formatMap;
std::set<int> m_seenBlocks;
int m_nextResultToHandle = 0;