forked from qt-creator/qt-creator
Revert "TextEditor: Use synchronous highlighter by default"
This reverts commit 1c47a0a301
.
Changing the default revealed a crash that seem to be caused by the
async syntax highlighter infra structure changes. Revert the default for
now to figure out the cause of the crash.
Task-number: QTCREATORBUG-30494
Change-Id: I1d0388c29d206cb25f2d58e4b305aa8303db2a60
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Robert Löhning
parent
cc30e923ff
commit
0539e2a0f6
@@ -914,23 +914,19 @@ bool TextDocument::reload(QString *errorString, ReloadFlag flag, ChangeType type
|
|||||||
void TextDocument::resetSyntaxHighlighter(const std::function<SyntaxHighlighter *()> &creator,
|
void TextDocument::resetSyntaxHighlighter(const std::function<SyntaxHighlighter *()> &creator,
|
||||||
bool threaded)
|
bool threaded)
|
||||||
{
|
{
|
||||||
delete d->m_highlighterRunner;
|
if (d->m_highlighterRunner)
|
||||||
|
delete d->m_highlighterRunner;
|
||||||
|
|
||||||
static const std::optional<bool> envValue = []() -> std::optional<bool> {
|
static const bool envValue
|
||||||
const QString key("QTC_USE_THREADED_HIGHLIGHTER");
|
= qtcEnvironmentVariable("QTC_USE_THREADED_HIGHLIGHTER", "TRUE").toUpper()
|
||||||
if (qtcEnvironmentVariableIsSet(key)) {
|
== QLatin1String("TRUE");
|
||||||
const QString value = qtcEnvironmentVariable(key).toUpper();
|
|
||||||
return value != "FALSE" && value != "0";
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}();
|
|
||||||
|
|
||||||
SyntaxHighlighter *highlighter = creator();
|
SyntaxHighlighter *highlighter = creator();
|
||||||
highlighter->setFontSettings(TextEditorSettings::fontSettings());
|
highlighter->setFontSettings(TextEditorSettings::fontSettings());
|
||||||
highlighter->setMimeType(mimeType());
|
highlighter->setMimeType(mimeType());
|
||||||
d->m_highlighterRunner = new SyntaxHighlighterRunner(highlighter,
|
d->m_highlighterRunner = new SyntaxHighlighterRunner(highlighter,
|
||||||
document(),
|
document(),
|
||||||
envValue.value_or(threaded));
|
threaded && envValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextDocument::cleanWhitespace(const QTextCursor &cursor)
|
void TextDocument::cleanWhitespace(const QTextCursor &cursor)
|
||||||
|
@@ -127,7 +127,7 @@ public:
|
|||||||
QTextDocument *document() const;
|
QTextDocument *document() const;
|
||||||
|
|
||||||
using SyntaxHighLighterCreator = std::function<SyntaxHighlighter *()>;
|
using SyntaxHighLighterCreator = std::function<SyntaxHighlighter *()>;
|
||||||
void resetSyntaxHighlighter(const SyntaxHighLighterCreator &creator, bool threaded = false);
|
void resetSyntaxHighlighter(const SyntaxHighLighterCreator &creator, bool threaded = true);
|
||||||
SyntaxHighlighterRunner *syntaxHighlighterRunner() const;
|
SyntaxHighlighterRunner *syntaxHighlighterRunner() const;
|
||||||
|
|
||||||
bool reload(QString *errorString, QTextCodec *codec);
|
bool reload(QString *errorString, QTextCodec *codec);
|
||||||
|
Reference in New Issue
Block a user