forked from qt-creator/qt-creator
Highlighter: fix crash after closing file
Regular expression rules are tracked inside the progress data to inform the rule about a finished highlighting process. A cloned rule was not properly tracked. That results in a rule that tries to untrack itself on destruction after the progress data has already been deleted. Task-number: QTCREATORBUG-20247 Change-Id: I007e7afbc16706bc28f89faf91c0b1c5f0bc692a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -247,6 +247,14 @@ bool RegExprRule::doMatchSucceed(const QString &text,
|
||||
return false;
|
||||
}
|
||||
|
||||
RegExprRule *RegExprRule::doClone() const
|
||||
{
|
||||
auto clone = new RegExprRule(*this);
|
||||
if (m_progress)
|
||||
m_progress->trackRule(clone);
|
||||
return clone;
|
||||
}
|
||||
|
||||
// Keyword
|
||||
KeywordRule::KeywordRule(const QSharedPointer<HighlightDefinition> &definition) :
|
||||
m_overrideGlobal(false),
|
||||
|
@@ -124,7 +124,7 @@ private:
|
||||
virtual bool doMatchSucceed(const QString &text,
|
||||
const int length,
|
||||
ProgressData *progress);
|
||||
virtual RegExprRule *doClone() const { return new RegExprRule(*this); }
|
||||
virtual RegExprRule *doClone() const;
|
||||
virtual void doReplaceExpressions(const QStringList &captures);
|
||||
virtual void doProgressFinished();
|
||||
|
||||
|
Reference in New Issue
Block a user