forked from qt-creator/qt-creator
SyntaxHighlighter: Fix leaking
Change-Id: Icd9e6cb18facbcb28692db114b952e96a66e2836 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -9,8 +9,9 @@
|
|||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QTextDocument>
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QTextDocument>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
@@ -197,6 +198,9 @@ void SyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int ch
|
|||||||
QList<SyntaxHighlighter::Result> vecRes;
|
QList<SyntaxHighlighter::Result> vecRes;
|
||||||
|
|
||||||
while (block.isValid() && (block.position() < endPosition || forceHighlightOfNextBlock)) {
|
while (block.isValid() && (block.position() < endPosition || forceHighlightOfNextBlock)) {
|
||||||
|
if (QThread::currentThread()->isInterruptionRequested())
|
||||||
|
break;
|
||||||
|
|
||||||
const int stateBeforeHighlight = block.userState();
|
const int stateBeforeHighlight = block.userState();
|
||||||
|
|
||||||
reformatBlock(block, from, charsRemoved, charsAdded);
|
reformatBlock(block, from, charsRemoved, charsAdded);
|
||||||
|
@@ -266,6 +266,7 @@ ThreadedSyntaxHighlighterRunner::ThreadedSyntaxHighlighterRunner(SyntaxHighLight
|
|||||||
|
|
||||||
ThreadedSyntaxHighlighterRunner::~ThreadedSyntaxHighlighterRunner()
|
ThreadedSyntaxHighlighterRunner::~ThreadedSyntaxHighlighterRunner()
|
||||||
{
|
{
|
||||||
|
m_thread.requestInterruption();
|
||||||
m_thread.quit();
|
m_thread.quit();
|
||||||
m_thread.wait();
|
m_thread.wait();
|
||||||
}
|
}
|
||||||
|
@@ -62,6 +62,12 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~TextDocumentPrivate()
|
||||||
|
{
|
||||||
|
if (m_highlighterRunner)
|
||||||
|
m_highlighterRunner->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
MultiTextCursor indentOrUnindent(const MultiTextCursor &cursor, bool doIndent, const TabSettings &tabSettings);
|
MultiTextCursor indentOrUnindent(const MultiTextCursor &cursor, bool doIndent, const TabSettings &tabSettings);
|
||||||
void resetRevisions();
|
void resetRevisions();
|
||||||
void updateRevisions();
|
void updateRevisions();
|
||||||
|
Reference in New Issue
Block a user