forked from qt-creator/qt-creator
GlslEditor: Fix crash
Task-number: QTCREATORBUG-14116 Change-Id: I48549806b7108d31519dc573039496b727e7a0af Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
@@ -214,13 +214,12 @@ void GlslEditorWidget::updateDocumentNow()
|
||||
const QByteArray preprocessedCode = contents.toLatin1(); // ### use the QtCreator C++ preprocessor.
|
||||
|
||||
Document::Ptr doc(new Document());
|
||||
Engine engine;
|
||||
doc->_engine = new Engine();
|
||||
Parser parser(doc->_engine, preprocessedCode.constData(), preprocessedCode.size(), variant);
|
||||
TranslationUnitAST *ast = parser.parse();
|
||||
if (ast != 0 || extraSelections(CodeWarningsSelection).isEmpty()) {
|
||||
Semantic sem;
|
||||
Scope *globalScope = engine.newNamespace();
|
||||
Scope *globalScope = new Namespace();
|
||||
doc->_globalScope = globalScope;
|
||||
const GlslEditorPlugin::InitFile *file = GlslEditorPlugin::shaderInit(variant);
|
||||
sem.translationUnit(file->ast, globalScope, file->engine);
|
||||
@@ -232,7 +231,7 @@ void GlslEditorWidget::updateDocumentNow()
|
||||
file = GlslEditorPlugin::fragmentShaderInit(variant);
|
||||
sem.translationUnit(file->ast, globalScope, file->engine);
|
||||
}
|
||||
sem.translationUnit(ast, globalScope, &engine);
|
||||
sem.translationUnit(ast, globalScope, doc->_engine);
|
||||
|
||||
CreateRanges createRanges(document(), doc);
|
||||
createRanges(ast);
|
||||
@@ -248,7 +247,7 @@ void GlslEditorWidget::updateDocumentNow()
|
||||
QList<QTextEdit::ExtraSelection> sels;
|
||||
QSet<int> errors;
|
||||
|
||||
foreach (const DiagnosticMessage &m, engine.diagnosticMessages()) {
|
||||
foreach (const DiagnosticMessage &m, doc->_engine->diagnosticMessages()) {
|
||||
if (! m.line())
|
||||
continue;
|
||||
else if (errors.contains(m.line()))
|
||||
|
||||
Reference in New Issue
Block a user