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:
David Schulz
2015-02-02 15:00:19 +01:00
parent 26972ade65
commit d7e5d41494

View File

@@ -164,16 +164,17 @@ void Highlighter::highlightBlock(const QString &text)
handleContextChange(m_currentContext->lineBeginContext(),
m_currentContext->definition());
ProgressData progress;
ProgressData *progress = new ProgressData;
const int length = text.length();
while (progress.offset() < length)
iterateThroughRules(text, length, &progress, false, m_currentContext->rules());
while (progress->offset() < length)
iterateThroughRules(text, length, progress, false, m_currentContext->rules());
if (extractObservableState(currentBlockState()) != WillContinue) {
handleContextChange(m_currentContext->lineEndContext(),
m_currentContext->definition(),
false);
}
delete progress;
m_contexts.clear();
if (m_indentationBasedFolding) {