forked from qt-creator/qt-creator
Editor: Fix crash in generic highlighter.
Make sure that the progress data object is deleted before the rule. Task-number: QTCREATORBUG-13883 Change-Id: Ie0d1825e695f0bfa7d46ee6dd807a94c95a08cd7 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -164,16 +164,17 @@ void Highlighter::highlightBlock(const QString &text)
|
|||||||
handleContextChange(m_currentContext->lineBeginContext(),
|
handleContextChange(m_currentContext->lineBeginContext(),
|
||||||
m_currentContext->definition());
|
m_currentContext->definition());
|
||||||
|
|
||||||
ProgressData progress;
|
ProgressData *progress = new ProgressData;
|
||||||
const int length = text.length();
|
const int length = text.length();
|
||||||
while (progress.offset() < length)
|
while (progress->offset() < length)
|
||||||
iterateThroughRules(text, length, &progress, false, m_currentContext->rules());
|
iterateThroughRules(text, length, progress, false, m_currentContext->rules());
|
||||||
|
|
||||||
if (extractObservableState(currentBlockState()) != WillContinue) {
|
if (extractObservableState(currentBlockState()) != WillContinue) {
|
||||||
handleContextChange(m_currentContext->lineEndContext(),
|
handleContextChange(m_currentContext->lineEndContext(),
|
||||||
m_currentContext->definition(),
|
m_currentContext->definition(),
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
delete progress;
|
||||||
m_contexts.clear();
|
m_contexts.clear();
|
||||||
|
|
||||||
if (m_indentationBasedFolding) {
|
if (m_indentationBasedFolding) {
|
||||||
|
Reference in New Issue
Block a user