GlslEditor: Fix crash in GlslHighlighter

since the async highlighter implementation the parent is not a
TextDocument anymore, but a QTextDocument. Pass the required mimeType
via the SyntaxHighlighterRunner now to the SyntaxHighlighter.

Change-Id: I0afcbe68719195649b4b7040416a743cb01214df
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
This commit is contained in:
David Schulz
2024-01-29 13:43:46 +01:00
parent 256ae21c07
commit d651d8b41f
7 changed files with 32 additions and 12 deletions

View File

@@ -30,6 +30,7 @@ public:
SyntaxHighlighterRunnerPrivate(SyntaxHighlighterRunner::SyntaxHighlighterCreator creator,
QTextDocument *document,
bool async,
const QString &mimeType,
FontSettings fontSettings)
{
if (async) {
@@ -42,6 +43,7 @@ public:
m_highlighter.reset(creator());
m_highlighter->setFontSettings(fontSettings);
m_highlighter->setDocument(m_document);
m_highlighter->setMimeType(mimeType);
m_highlighter->setParent(m_document);
connect(m_highlighter.get(),
@@ -111,8 +113,9 @@ signals:
SyntaxHighlighterRunner::SyntaxHighlighterRunner(SyntaxHighlighterCreator creator,
QTextDocument *document,
bool async,
const QString &mimeType,
const TextEditor::FontSettings &fontSettings)
: d(new SyntaxHighlighterRunnerPrivate(creator, document, async, fontSettings))
: d(new SyntaxHighlighterRunnerPrivate(creator, document, async, mimeType, fontSettings))
, m_document(document)
{
m_useGenericHighlighter = qobject_cast<Highlighter *>(d->m_highlighter.get());